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 |
who can help me??wa了好多次了。hawk大哥帮帮忙!#include <iostream.h> #include <string.h> char a[100000001],b[100000001]; long lena,lenb,ok; void print() { if(ok==0) cout<<"No"<<endl; else cout<<"Yes"<<endl; } int main() { long p,q; while(cin) { cin>>a;cin>>b;ok=0; lena=strlen(a);lenb=strlen(b); p=0;q=0; for(long r=lena;r>=1;r--) { while(b[q]!=a[p]&&q<lenb-1) { q++; } if(b[q]!=a[p]) break; p++;q++; } if(r==0) ok=1; print(); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator