網頁

2014年1月21日 星期二

UVa 10340 All in All

如果陣列開很大的情況下,要放在global,不然會造成stack overflow,就會看到RuntimeError的出現。


#include <cstdio>
using namespace std;
char s[100000],t[100000];
int main()
{
// freopen ("input.txt","rt",stdin);
while (scanf("%s%s",s,t)!=EOF){
int i=0,j=0;
for (;t[i];i++){
if (t[i] == s[j]) j++;
}
if (!s[j]) printf("Yes\n");
else printf("No\n");
}
return 0;
}

沒有留言:

張貼留言