摘要:
http://poj.org/problem?id=1363 #include<cstdio>#include<stack>using namespace std;int a[1000];int main(void){ int n; while(scanf("%d",&n),n) { int x,t; stack<int> q; ...
阅读全文
posted @ 2012-10-08 20:18
Yogurt Shen
阅读(155)
推荐(0)
摘要:
http://poj.org/problem?id=1731 #include<cstdio>#include<cstring>#include<algorithm>using namespace std;int main(void){ char str[202]; while(gets(str)) { int n=strlen(str); s...
阅读全文
posted @ 2012-10-08 20:06
Yogurt Shen
阅读(164)
推荐(0)
摘要:
http://poj.org/problem?id=1256 #include<cstdio>#include<cstring>#include<cctype>#include<algorithm>using namespace std;char str[20];bool cmp(char a,char b){ if(tolower(a)==tolower(b)) r...
阅读全文
posted @ 2012-10-08 19:59
Yogurt Shen
阅读(216)
推荐(0)
摘要:
http://poj.org/problem?id=2503 #include<iostream>#include<string>#include<map>using namespace std;map<string,string> rule;int main(void){ int cur,len; string s,s1,s2; while(getline(cin,s)...
阅读全文
posted @ 2012-10-08 19:45
Yogurt Shen
阅读(129)
推荐(0)
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1698 #include<cstdio>#include<algorithm>#define lson l,m,rt<<1#define rson m+1,r,rt<<1|1using namespace std;const int maxn=111111;int h,w,n,col[maxn<<2],s...
阅读全文
posted @ 2012-08-31 11:07
Yogurt Shen
阅读(166)
推荐(0)
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=4027 #include<cstdio>#include<cstring>#include<cmath>#include<algorithm>#define lson l,m,rt<<1#define rson m+1,r,rt<<1|1#define maxn 100001using namespace...
阅读全文
posted @ 2012-08-31 11:05
Yogurt Shen
阅读(134)
推荐(0)
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=2852 #include<cstdio>#include<cstring>#include<algorithm>#define lson l,m,rt<<1#define rson m+1,r,rt<<1|1#define maxn 100010using namespace std;int sum[ma...
阅读全文
posted @ 2012-08-31 11:03
Yogurt Shen
阅读(138)
推荐(0)
摘要:
http://poj.org/problem?id=2182 #include<stdio.h>#define lson l,m,rt<<1#define rson m+1,r,rt<<1|1#define maxn 8080int tree[maxn<<2],d1[maxn],ans[maxn];void build(int l,int r,int rt){ tree[rt]=r-...
阅读全文
posted @ 2012-08-31 11:01
Yogurt Shen
阅读(187)
推荐(0)
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1556 #include<cstdio>#define lson l,m,rt<<1#define rson m+1,r,rt<<1|1#define MAX 100001int tree[MAX<<2];; void build(int l,int r,int rt){ tree[rt]=0; ...
阅读全文
posted @ 2012-08-31 11:00
Yogurt Shen
阅读(164)
推荐(0)
摘要:
http://poj.org/problem?id=2828 #include<stdio.h>#define lson l,m,rt<<1#define rson m+1,r,rt<<1|1const int maxn=200001;int pos[maxn],val[maxn],ans[maxn],em[maxn<<2],index;void build(int l,int r,int...
阅读全文
posted @ 2012-08-31 10:58
Yogurt Shen
阅读(182)
推荐(0)
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=2795 #include<cstdio>#include<algorithm>#define lson l,m,rt<<1#define rson m+1,r,rt<<1|1using namespace std;const int maxn=222222;int h,w,n,MAX[maxn<<2];v...
阅读全文
posted @ 2012-08-31 10:56
Yogurt Shen
阅读(172)
推荐(0)
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1394 #include<cstdio>#include<algorithm>#define lson l,m,rt<<1#define rson m+1,r,rt<<1|1using namespace std;const int maxn=5555;int sum[maxn<<2],x[maxn];v...
阅读全文
posted @ 2012-08-31 10:53
Yogurt Shen
阅读(256)
推荐(0)
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1754 #include<cstdio>#include<algorithm>#define lson l,m,rt<<1#define rson m+1,r,rt<<1|1using namespace std;const int maxn=222222;int MAX[maxn<<2];void Pu...
阅读全文
posted @ 2012-08-31 10:51
Yogurt Shen
阅读(225)
推荐(0)
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1166 线段树第一题 #include<cstdio>#define lson l,m,rt<<1#define rson m+1,r,rt<<1|1const int maxn=55555;int sum[maxn<<2];void PushUP(int rt) { sum[rt]=sum[rt...
阅读全文
posted @ 2012-08-31 10:49
Yogurt Shen
阅读(264)
推荐(0)
摘要:
#include<cstdio>#include<cstring>#include<algorithm>using namespace std;int dp[1010],a[1010];int main(void){ int n,m,i,j,k,Max; while(scanf("%d",&n),n) { Max=0; for(i=1;i<=n;...
阅读全文
posted @ 2012-08-31 10:43
Yogurt Shen
阅读(158)
推荐(0)
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1561 #include<cstdio>#include<cstring>#include<algorithm>using namespace std;int n,m,num[250],map[250][250],dp[250][250],vis[250];void dfs(int p){ int ...
阅读全文
posted @ 2012-08-31 10:42
Yogurt Shen
阅读(201)
推荐(0)
摘要:
http://poj.org/problem?id=1787 #include<stdio.h>#include<string.h>int C[4],ans[30],p[10010],vis[10010],dp[10010],T[4]={1,5,10,25};int main(void){ int m,i,j,sum; while(scanf("%d",&m)!=EOF) ...
阅读全文
posted @ 2012-08-31 10:39
Yogurt Shen
阅读(315)
推荐(0)
摘要:
http://acmpj.zstu.edu.cn/JudgeOnline/showproblem?problem_id=3286 #include<cstdio>#include<cstring>#include<algorithm>#define INF 1<<29using namespace std; int dp[51][100003],c[11],v[11],n,w,p,m,i,...
阅读全文
posted @ 2012-08-31 10:36
Yogurt Shen
阅读(232)
推荐(0)
摘要:
http://poj.org/problem?id=1742 #include<stdio.h>#include<string.h>int dp[100010],C[110],A[110],vis[100010];int main(void){ int n,m,i,j,ans; while(scanf("%d%d",&n,&m),n||m) { for(i=...
阅读全文
posted @ 2012-08-31 10:32
Yogurt Shen
阅读(120)
推荐(0)
摘要:
http://poj.org/problem?id=3260 #include<cstdio>#include<cstring>#include<algorithm>#define INF 1<<29using namespace std;int T,N,V[1001],C[1001],buy[40000],sell[40000],i,j,k,maxv,ans;int main(void)...
阅读全文
posted @ 2012-08-31 10:26
Yogurt Shen
阅读(223)
推荐(0)
摘要:
http://poj.org/problem?id=2063 #include<cstdio>#include<algorithm>using namespace std;int dp[1000000],w[11],v[11],sum,n,y;int main(void){ int t,i,j,V; scanf("%d",&t); while(t--) { ...
阅读全文
posted @ 2012-08-31 10:23
Yogurt Shen
阅读(111)
推荐(0)
摘要:
http://poj.org/problem?id=1252 #include<cstdio>#include<algorithm>using namespace std;const int INF=20000000;const int MAXV=100*100+100+1;int f[MAXV],a[6],t,i,j,maxV,tot,_max;float ave;int main(vo...
阅读全文
posted @ 2012-08-31 10:20
Yogurt Shen
阅读(253)
推荐(0)
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1114 #include<cstdio>#include<cstring>#include<algorithm>#define INF 1000000000using namespace std;int dp[20000],P[1000],W[1000],E,F,N,M;int main(void){ ...
阅读全文
posted @ 2012-08-31 10:10
Yogurt Shen
阅读(159)
推荐(0)
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=3535 #include<cstdio>#include<cstring>#include<algorithm>using namespace std;int dp[110][110],c[110],g[110],n,T,i,j,k,m,s;void case0(){ for(j=0;j<=T;j+...
阅读全文
posted @ 2012-08-31 10:07
Yogurt Shen
阅读(235)
推荐(0)
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1712 #include<cstdio>#include<algorithm>#define maxn 111using namespace std;int dp[maxn],a[maxn][maxn],i,j,k,n,m;int main(void){ while(scanf("%d%d",&n,...
阅读全文
posted @ 2012-08-31 10:05
Yogurt Shen
阅读(119)
推荐(0)
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=3033#include<cstdio>#include<cstring>#include<algorithm>using namespace std;int brand[124],price[124],value[124],dp[15][100024];int main(void){ int N,K,M,i,j,k; while(scanf("%d%d%d",&N,&M,&K)!=EOF) { for(i=0;i<N;i++
阅读全文
posted @ 2012-08-31 10:01
Yogurt Shen
阅读(158)
推荐(0)
摘要:
http://poj.org/problem?id=1948 #include<cstdio>#include<cmath>#include<algorithm>using namespace std;int l[44],dp[888][888];int area(int x,int y,int z){ double p=(x+y+z)/2.0; return (int)(sq...
阅读全文
posted @ 2012-08-31 09:59
Yogurt Shen
阅读(102)
推荐(0)
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=2955#include<cstdio>#include<cstring>#include<algorithm>using namespace std;double q[105],dp[10005];int m[105];int main(void){ int t,n,i,j,sum; double p; scanf("%d",&t) ; while(t--) { scanf("%lf%d",&p,&n); su
阅读全文
posted @ 2012-08-31 09:57
Yogurt Shen
阅读(131)
推荐(0)
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1203 #include<cstdio>#include<algorithm>using namespace std;double dp[10005];int main(void){ int n,m,ai,i,j; double bi; while(scanf("%d%d",&n,&m)...
阅读全文
posted @ 2012-08-31 09:55
Yogurt Shen
阅读(124)
推荐(0)
摘要:
http://poj.org/problem?id=1837 #include<stdio.h>#include<string.h>int dp[21][15001],c[21],g[21];int main(void){ int C,G,i,j,k; scanf("%d %d",&C,&G); for(i=0;i<C;i++) scanf("%d",&c[...
阅读全文
posted @ 2012-08-31 09:52
Yogurt Shen
阅读(140)
推荐(0)
摘要:
http://poj.org/problem?id=3628 #include<cstdio>using namespace std;const int mm=20000000;bool dp[mm];int h[22],i,j,k,n,b,m;int main(void){ while(scanf("%d%d",&n,&b)!=EOF) { m=0; ...
阅读全文
posted @ 2012-08-31 09:50
Yogurt Shen
阅读(122)
推荐(0)
摘要:
http://poj.org/problem?id=3624 背包第一题 #include<cstdio>#include<cstring>#include<algorithm>#define maxn 30000using namespace std;int weight[maxn],val[maxn],dp[maxn],N,M,i,j;int main(void){ while...
阅读全文
posted @ 2012-08-31 09:47
Yogurt Shen
阅读(140)
推荐(0)