2012年8月3日

poj1936 All in All

摘要: 1 #include<stdio.h> 2 char str[100001],sub[100001]; 3 int main() 4 { 5 int i,k; 6 while(~scanf("%s%s",sub,str)) 7 { 8 for(k=i=0;str[i];i++) 9 if(str[i]==sub[k]&&sub[k])10 k++;11 if(sub[k]) printf("No\n");12 else printf("Yes\n");13 ... 阅读全文

posted @ 2012-08-03 23:50 小花熊 阅读(150) 评论(0) 推荐(0) 编辑

poj1047 Round and Round We Go

摘要: 1 #include<stdio.h> 2 #include<string.h> 3 int main() 4 { 5 char s[65],b[65],str[60][65]; 6 int i,k,t,c,len; 7 bool flag; 8 while(~scanf("%s",s)){ 9 len=strlen(s);10 for(i=0;i<len;++i){11 strcpy(str[i],s+i);12 strncat(str[i],s,i);13 }1... 阅读全文

posted @ 2012-08-03 23:02 小花熊 阅读(157) 评论(0) 推荐(0) 编辑

hdu2036 改革春风吹满地

摘要: 1 #include<math.h> 2 #include<stdio.h> 3 int main() 4 { 5 int i,n,a[110][2]; 6 double s; 7 while(scanf("%d",&n),n) 8 { 9 for(s=i=0;i<n;i++)10 scanf("%d%d",&a[i][0],&a[i][1]);11 for(i=2;i<n;i++)12 s+=(a[i][1]-a[i-1][1])*(a[0][0]-a[i][0]) //注意是有向面积,因为. 阅读全文

posted @ 2012-08-03 18:42 小花熊 阅读(184) 评论(0) 推荐(0) 编辑

poj1298 The Hardest Problem Ever

摘要: 1 #include<iostream> 2 #include<cstring> 3 using namespace std; 4 int main() 5 { 6 char *p,s[201]; 7 while(cin.getline(s,100),strcmp(s,"ENDOFINPUT")) 8 { 9 if(!strcmp(s,"START")) continue;10 else if(!strcmp(s,"END")) continue;11 else{12 for(p=s;*p;p++... 阅读全文

posted @ 2012-08-03 15:49 小花熊 阅读(163) 评论(0) 推荐(0) 编辑

nyoj305 表达式求值

摘要: 1 #include<stdio.h> 2 char s[301],cstack[120]; 3 int dstack[80]; 4 int i,ctop,dtop; 5 int Operate(int a,char theta,int b) 6 { 7 switch(theta){ 8 case 'd': return a+b; 9 case 'n': return a>b?b:a;10 case 'x': return a>b?a:b;11 }12 }13 int EvaluateExpression()14 {15 阅读全文

posted @ 2012-08-03 12:41 小花熊 阅读(224) 评论(0) 推荐(0) 编辑

poj2255 Tree Recovery

摘要: 1 #include<cstdio> 2 #include<iostream> 3 #include<algorithm> 4 using namespace std; 5 struct Node 6 { 7 char data; 8 Node *lchild; 9 Node *rchild;10 };11 Node *CreatTree(string pre,string in)12 {13 Node *root=NULL;14 if(pre.length()>0)15 {16 root=new Node;17 ... 阅读全文

posted @ 2012-08-03 09:35 小花熊 阅读(155) 评论(0) 推荐(0) 编辑

导航