uva - 10340 - All in All 解题报告
原题链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1281
题目大意:有两个字串s,t,当移走t字串的某些字符后,如果剩下的为字串s,则输出Yes,否则输出No。
刚开始定义了一个1000的数组,结果RE,然后补到10000,依旧如此,再补一个0,WA了。
1 #include<stdio.h> 2 #define M 100000 3 int main(){ 4 char s[M],a[M]; 5 int i,j; 6 while(scanf("%s%s",s,a)!=EOF){ 7 for(i=0,j=0;a[i]!='\0'&&s[j]!='\0';i++) 8 if(s[j]==a[i]) j++; 9 if(s[j]=='\0') printf("Yes\n"); 10 else printf("No\n"); 11 } 12 }