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啊??#include <stdio.h> #include <string.h> int compare(char a[],char b[]) { int i,j,k=0,flag=0; for(i=0;i<strlen(a);i++) { for(j=flag;j<strlen(b);j++) if(a[i]==b[j]) {k++;break;} flag=j+1; } if(k==strlen(a)) return 1; else return 0; } int main() { char a[200],b[200],c[400];int n,i; scanf("%d",&n); for(i=1;i<=n;i++) { scanf("%*c");scanf("%s",a); scanf("%*c");scanf("%s",b); scanf("%*c");scanf("%s",c); if(compare(a,c)==1&&compare(b,c)==1) printf("Data set %d: yes\n",i); else printf("Data set %d: no\n",i); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator