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

为什么会output limit exceed呢,谢谢啊

Posted by 00 at 2005-07-20 23:08:05 on Problem 2503
#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