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 |
0ms过了In Reply To:我的16ms啊,怎么搞成0ms 啊。我实在是想不到 Posted by:liushengbing at 2010-05-28 16:45:59 #include<iostream> #include<cstring> using namespace std; int main () { char s[100002],sub[100002]; while(scanf("%s%s",sub,s)!=EOF) { int l_s,l_sub; l_sub=strlen(sub); l_s=strlen(s); int pre=-1; int sum=0; for(int i=0;i<l_sub;i++) for(int j=pre+1;j<l_s;j++) if(sub[i]==s[j]){pre=j;sum++;break;} if(sum==l_sub)cout<<"Yes"<<endl; else cout<<"No"<<endl; } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator