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

那个大牛帮忙看一下 那个地方不对 谢谢

Posted by 0912070002 at 2010-07-04 01:47:12 on Problem 2575
#include <stdio.h>
#include <string.h>
#include <math.h>

int main(void)
{
	int a[3010];
	int n,first,second,i,val,flag;

	while(scanf("%d",&n) != EOF)
	{
		flag = 0;
		memset(a,0,sizeof(a));
		scanf("%d",&first);
		for (i = 1; i < n; i++)
		{
			scanf("%d",&second);
			val = abs(second-first);
			if ((val == 0 || val >= n) || (a[val] == 1))
			{
				printf("Not jolly\n");
				flag = 1;
				fflush(stdin);
				break;
			}
			a[val] = 1;
			first = second;
		}
		if (flag == 0)
		{
			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