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 hawk at 2005-04-29 16:50:49 on Problem 1936
In Reply To:hawk大哥能不能给解释一下 Posted by:tencent at 2005-04-29 16:47:56
> 这种题竟会超时??
> 可原代码没看出有问题啊??
> 
> #include<iostream.h>
> 
> void main()
> {
> 	char a[10000],b[10000];
> 	int i,j,iftrue;
> 	while(cin>>a>>b)
> 	{
> 		i=0;j=0;
> 		while(a[i] != '\0')
> 		{
> 			iftrue=0;
> 			while(b[j] != '\0')
> 			{
> 				if(a[i] == b[j])
> 				{
> 					i++;
> 					j++;
> 					iftrue=1;
> 					break;
> 				}
> 				else j++;
> 			}
> 			if(iftrue==0)
> 			{
> 				cout<<"No"<<endl;
> 				break;
> 			}
> 		}
> 		if(a[i] == '\0')
> 			cout<<"Yes"<<endl;
> 	}
> }
> 
> 
> 
> 

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