上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 36 下一页

2011年7月9日

zoj 1642

摘要: #include<iostream>#include<fstream>#include<cstring>using namespace std;int n;int map[300];char c1[2001],c2[2001];int dp[2002][2002];void read(){// ifstream cin("in.txt"); int i,j,k; char c; while(cin>>n) { for(i=1;i<=n;i++) { cin>>c>>j; map[(int)c]=j 阅读全文

posted @ 2011-07-09 15:40 宇宙吾心 阅读(160) 评论(0) 推荐(0)

zoj 1636

摘要: #include<iostream>#include<fstream>#include<stdio.h>using namespace std;long long map[501][501];int n,m;void read(){// ifstream cin("in.txt"); int i,j,k,s,t,i1,j1; int cas; scanf("%d",&cas); for(s=1;s<=cas;s++) { printf("Case %d:\n",s); scanf(&q 阅读全文

posted @ 2011-07-09 15:21 宇宙吾心 阅读(160) 评论(0) 推荐(0)

zoj 1602

摘要: #include<iostream>#include<fstream>using namespace std;int n;long long dp[101][101];int a[101];void read(){// ifstream cin("in.txt"); int i,j,k,s; while(cin>>n) { for(i=1;i<=n;i++) cin>>a[i]; for(s=2;s<=n;s++) for(i=1;i+s<=n;i++) { j=i+s; dp[i][j]=-1; for(k 阅读全文

posted @ 2011-07-09 15:21 宇宙吾心 阅读(268) 评论(0) 推荐(0)

zoj 1733

摘要: #include<iostream>#include<fstream>#include<cstring>using namespace std;char c1[1001],c2[1001];int dp[1011][1011];void read(){// ifstream cin("in.txt"); int i,j,k; int n1,n2; while(cin>>c1>>c2) { n1=strlen(c1); n2=strlen(c2); for(i=1;i<=n1;i++) for(j=1;j< 阅读全文

posted @ 2011-07-09 15:20 宇宙吾心 阅读(266) 评论(0) 推荐(0)

2011年7月8日

zoj 1524

摘要: #include<iostream>#include<fstream>#include<memory.h>using namespace std;int a[101];int p[100001];double q[100001];double dp[2][100001];int n,m;void read(){// ifstream cin("in.txt"); int i,j,k; while(cin>>n>>m) { if(n==0&&m==0) return; for(i=1;i<=n; 阅读全文

posted @ 2011-07-08 18:20 宇宙吾心 阅读(186) 评论(0) 推荐(0)

zoj 1563

摘要: #include<iostream>#include<fstream>using namespace std;int p[101];int sum[101];int dp[101];int n;void read(){// ifstream cin("in.txt"); int i,j,k; int cas; cin>>cas; while(cas--) { cin>>n; for(i=1;i<=n;i++) { cin>>j>>p[i]; sum[i]=sum[i-1]+j; } for(i=1 阅读全文

posted @ 2011-07-08 16:23 宇宙吾心 阅读(181) 评论(0) 推荐(0)

zoj 1196

摘要: #include<iostream>#include<fstream>#include<cmath>#include<memory.h>using namespace std;int a[201];int w[201][201];int dp[201][31];int n,m;int abs(int s){ if(s>0) return s; else return -s;}void read(){// ifstream cin("in.txt"); int i,j,k,s,t; int cas=0; while(cin 阅读全文

posted @ 2011-07-08 15:08 宇宙吾心 阅读(212) 评论(0) 推荐(0)

zoj 1163

摘要: #include<iostream>#include<fstream>using namespace std;double dp[501][501];int n;void read(){// ifstream cin("in.txt"); int i,j,k; for(i=0;i<=500;i++) dp[0][i]=1; for(i=1;i<=500;i++) for(j=1;j<=500;j++) { dp[i][j]=dp[i][j-1]; if(i>=j) dp[i][j]+=dp[i-j][j-1]; } while 阅读全文

posted @ 2011-07-08 14:42 宇宙吾心 阅读(212) 评论(0) 推荐(0)

2011年7月7日

poj 1606

摘要: #include<iostream>#include<fstream>#include<queue>using namespace std;int n,m,p;struct node{ int s,t;};int pre[1001][1001];node pre1[1001][1001];int v[1001][1001];void print(int s,int t){ int i,j,k; if(pre[s][t]!=-1) { print(pre1[s][t].s,pre1[s][t].t); if(pre[s][t]==1) cout<< 阅读全文

posted @ 2011-07-07 19:12 宇宙吾心 阅读(249) 评论(0) 推荐(0)

poj 2386

摘要: #include<iostream>#include<fstream>#include<queue>using namespace std;int n,m;struct node{ int s,t;};int v[101][101];int move[8][2]={0,1,0,-1,1,0,-1,0,1,-1,1,1,-1,1,-1,-1};int map[101][101];void bfs(int s,int t){ int i,j,k; v[s][t]=1; queue<node> q; node a; a.s=s; a.t=t; q.pu 阅读全文

posted @ 2011-07-07 14:37 宇宙吾心 阅读(217) 评论(0) 推荐(0)

上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 36 下一页

导航