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 |
while(scanf("%s",a)!=NULL) ->while(scanf("%s",a)!=EOF),OR you can use while(gets(a)!=NULL)In Reply To:为什么总是超时??? Posted by:dingdongsheng at 2008-10-09 15:11:19 > #include<stdio.h> > #include<string.h> > char a[100000],b[100000]; > void main() > { > int i,j,len1,len2; > > while(scanf("%s",a)!=NULL) > { > int count=0; > getchar(); > gets(b); > len1=strlen(a); > len2=strlen(b); > j=0; > for(i=0;i<len2;i++) > { > if(a[j]==b[i]) > j++; > if(j==len1) > { > printf("Yes\n"); > count=1; > break; > } > } > > if(count==0) > printf("No\n"); > } > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator