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

改啊改啊还是超时. 贴个代码 帮我看看吧

Posted by kainbro at 2010-01-08 22:33:41 on Problem 1936 and last updated at 2010-01-09 20:01:04
In Reply To:改啊改啊还是超时. Posted by:kainbro at 2010-01-08 22:32:47
#include<stdio.h>
int issub(char *, char *);
main()
{
      char s1[100000];
      char s2[100000];

      while(scanf("%s %s",&s2,&s1)){
	  				  if(issub(s1,s2))
			                       printf("Yes");
					  else
					       printf("No");
				   }   				
}

int issub(char *s1, char *s2)
{
    while(*s1 != '\0'){
			  if(*s2 == *s1) 
			  {
			    s1++;
		            s2++;
			   }
                          else
                            s1++;
		      }
    if(*s2 == '\0')
		   return 1;
	else
		   return 0;	
}

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