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

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

Posted by HH_2007 at 2010-03-22 22:39:04 on Problem 1936
In Reply To:改啊改啊还是超时. 贴个代码 帮我看看吧 Posted by:kainbro at 2010-01-08 22:33:41
> #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;	
> }

数组开的不够大
scanf语句又写错
对你。。。。。。。。。

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