Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

while(scanf("%s",a)!=NULL) ->while(scanf("%s",a)!=EOF),OR you can use while(gets(a)!=NULL)

Posted by zrO_0rz at 2008-10-09 16:48:19 on Problem 1936
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator