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 bjtu1 at 2009-04-08 16:29:32 on Problem 2575
/*author:bjtu1

/*time:8 Apr 2009

#include<stdio.h>
#include<memory.h>

int gap[3010];
int num[3010];


int main()
{
	int n,dif;
	int sum,i;


	while(scanf("%d",&n)!=EOF){
		memset(gap,0,sizeof(gap));
		sum=0;
		scanf("%d",&num[0]);
		for(i=1;i<n;i++){
			scanf("%d",&num[i]);
			dif=(num[i]>num[i-1])?(num[i]-num[i-1]):(num[i-1]-num[i]);
			if(!gap[dif]&&dif!=0&&dif<=n-1){
				sum++;
				gap[dif]=1;
			}
		}
        if(n==1&&num[0]==1)
			printf("Jolly\n");
		else if(n==1&&num[0]!=1)
			printf("Not jolly\n");
		else if(sum==n-1)
			printf("Jolly\n");
		else 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