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 Exceeded哪位帮忙看一下啊,疯掉啦.......................

Posted by hkspirt at 2008-12-02 16:43:38 on Problem 2575

#include<stdio.h>
#include<math.h>

int Array[3000];
int Cha[3000];

int main (void)
{	
	int n,i,c;

	while(scanf("%d",&n)!=EOF)
	{
		if(n==1)
		{
			scanf("%d",&Array[0]);
			printf("Jolly\n");
		}

		else if(n>1)
		{
			for(i=1;i<=n;++i)
			{
				scanf("%d",&Array[i]);
			}
	
			for(i=1;i<n;i++)
			{
				c=Array[i]-Array[i+1];
				Cha[i]=abs(c);
			}
		


			if((Cha[1]==1)&&n!=2)
			{
				for(i=1;i<n;i++)
				{
					if(Cha[i]!=i)
					{
						printf("Not jolly\n");
						break;
					}
					if(i==(n-1))
					{
						printf("Jolly\n");
					}
				}
			}


			if(Cha[1]==(n-1))
			{
				for(i=1;i<n;i++)
				{
					if(Cha[i]!=(n-i))
					{
						printf("Not jolly\n");
						break;
					}
					if(i==(n-1))
					{
						printf("Jolly\n");
					}
				}
			}

			if((Cha[1]!=(n-1))&&(Cha[1]!=1)) printf("Not 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