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 |
水过(附代码)#include<cstdio> #include<cstring> using namespace std; const int STRLEN=100001; char strS[STRLEN]; char strT[STRLEN]; int main() { while(scanf("%s%s",strS,strT)!=EOF) { int nTIndex=strlen(strT)-1; ///指向最后一个字符,用于从后向前遍历 int nSIndex=strlen(strS)-1; while(nTIndex>=0&&nSIndex>=0) { if(strT[nTIndex--]==strS[nSIndex]) { nSIndex--; } } if(nSIndex==-1) printf("Yes\n"); else printf("No\n"); } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator