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 |
hawk大哥能不能给解释一下这种题竟会超时?? 可原代码没看出有问题啊?? #include<iostream.h> void main() { char a[10000],b[10000]; int i,j,iftrue; while(cin>>a>>b) { i=0;j=0; while(a[i] != '\0') { iftrue=0; while(b[j] != '\0') { if(a[i] == b[j]) { i++; j++; iftrue=1; break; } else j++; } if(iftrue==0) { cout<<"No"<<endl; break; } } if(a[i] == '\0') cout<<"Yes"<<endl; } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator