Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
真的很郁闷!!!这两个程序有差别吗?程序1:AC Problem Id:1936 Memory:216K Time:0MS Language:C++ Result:Accepted #include <stdio.h> #include <string.h> char s[100000],t[100000]; void main() { int i,j; int len1,len2; while(scanf("%s%s",&s,&t)==2) { len1=strlen(s); len2=strlen(t); for(i=0,j=0;j<len1 && i<len2;j++) { while(s[j]!=t[i]&&i<len2)i++; i++; } if(j==len1&&i<=len2)printf("Yes\n"); else printf("No\n"); } } 程序2:Wrong Answer Problem Id:1936 Memory:220K Time:0MS Language:C++ Result:Wrong Answer #include <stdio.h> char s[100000],t[100000]; void main() { int i,j; while(scanf("%s%s",&s,&t)==2) { int sg=0; for(i=0,j=0;;j++) { if(s[j]=='\0') { sg=1; break; } if(t[i]=='\0')break; while(s[j]!=t[i]&&t[i]!='\0')i++; i++; } if(sg==1)printf("Yes\n"); else printf("No\n"); } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator