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

此题的输入有问题,不光是要处理多余的空格,如果读到换行才结束要TLE,

Posted by cangratul at 2009-05-18 08:54:39 on Problem 1030
or(int j=0;j<2;j++)
	{
		scanf("%d",&n);
		char c=getchar();
		while(c!='\n') c=getchar();
		cnt=1; tmp=0;
		for(int i=1;i<=n;i++)
		{
			cnt+=tmp;
			tmp=0;
			while((c=getchar())!=-1)
                        {           
                                           // while(1)
			                   //{
				           //    c=getchar();  这样的话TLE了
				if(c>='0'&&c<='9')
				{
					int sum=0;
					do
					{
						sum*=10;
						sum+=c-'0';
						c=getchar();
					}while(c>='0'&&c<='9');
					r[sum][j]=cnt;
					tmp++;
					f[sum]=1;
				}
				if(c=='\n') break;
			}
		}
	}

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