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

输入没处理好,以空行结束有时很容易搞杂, 我同学写了一个,一直RTE

Posted by sunmoonstar_love at 2005-07-20 23:42:14 on Problem 2503
In Reply To:为什么会output limit exceed呢,谢谢啊 Posted by:00 at 2005-07-20 23:08:05
> #include<iostream.h>
> #include<string.h>
> void main()
> {
> 	char d[100000][22],d1[100000][22],d2[100000][22],w[11];
> 	long i,j,n;
> 	for(i=0;;i++)
> 	{
> 		cin.getline(d[i],22);
> 		for(j=0;j<(long)strlen(d[i]);j++)
> 		{
> 			if(d[i][j]==' ')
> 			{
> 				for(int k=0;k<j;k++)
> 					d1[i][k]=d[i][k];
> 				d1[i][j]='\0';
> 				for(k=j+1;k<(int)strlen(d[i]);k++)
> 					d2[i][k-j-1]=d[i][k];
> 				d2[i][strlen(d[i])-j-1]='\0';
> 				break;
> 			}
> 		}
> 		if(strlen(d[i])==0)
> 			break;
> 	}
> 	n=i;
> 	while(1)
> 	{
> 		cin>>w;
> 		for(i=0;i<(long)strlen(w);i++)
> 		{
> 			if(w[i]<97||w[i]>122)
> 				break;
> 		}
> 		if(i<(long)strlen(w))
> 			break;
> 		for(i=0;i<n;i++)
> 		{
> 			if(!strcmp(w,d2[i]))
> 			{
> 				cout<<d1[i]<<endl;
> 				break;
> 			}
> 		}
> 		if(i==n)
> 			cout<<"eh"<<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