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 |
垃圾 贡献一次WA 原来是 l1>=l2 必须改为 l1>l2 (附代码)#include<iostream> #include<cstring> using namespace std; int fun(char *a,char *b) { int i,j,s=0; int l1=strlen(a),l2=strlen(b); if(l1>l2) return 0; else { for(i=0,j=0;i<l1,j<l2;j++) {if(a[i]==b[j]) {s++;i++;} else continue; } if(s==l1) return 1; else return 0; } } int main() { char m[100000],n[100000]; while(cin>>m>>n) { if(fun(m,n)==1) 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