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 |
不知怎么会TLE了,觉得没办法在精炼了么#include<iostream> using namespace std; int main() { char s[100000],t[100000]; while(scanf("%s %s",&s,&t)) { int i,j,l_s,l_t,k=0,flag=0; l_s=strlen(s); l_t=strlen(t); for(i=0;i<l_s;i++) { for(j=k;j<l_t;j++) if(s[i]==t[j]) { flag++; k=j; break; } } if(flag==l_s) cout<<"YES"<<endl; else cout<<"NO"<<endl; } return 0; } 谁帮忙看看啊 Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator