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 donkeyinacm at 2010-03-30 19:49:22 on Problem 2575
#include <iostream>
using namespace std;
#define MAXN 3005 
bool vis[MAXN];

int main()
{
	freopen("c:/a.txt","r",stdin);
	int i,j,n,x,y,ab,kill;
	while(scanf("%d",&n)!=EOF)
	{

		if(n==1)
		{
			scanf("%d",&y);
       		printf("Jolly\n");
		continue;
		}
		kill=0;
		fill(vis+1,vis+n,false);
		scanf("%d",&x);
		for(i=2;i<=n;i++)
		{
			scanf("%d",&y);
			ab=x-y;
			if(ab<0)
				ab=-ab;
			if(ab>n-1||ab==0)
			{
				kill=1;
				break;
			}
			else
			{
				if(!vis[ab])
					vis[ab]=true;
				else
				{
					kill=1;
					break;
				}
				x=y;
			}
		}
//如果上方在没输入完全就否决,要处理后面的输入,注,这里引起了RE,其实它多输入了一次,想想为什么吧.
		for(;i<=n;i++)
			scanf("%d",&y);
		if(kill)
			printf("Not jolly\n");
		else
			printf("Jolly\n");
	}
	return 0;
}

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