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 201824100813 at 2019-09-20 10:37:15 on Problem 2575
In Reply To:高手帮忙 Posted by:123WANGSONG at 2009-08-10 17:09:57
> #include<stdio.h>
> void main()
> {
> 	int n,i,j,sign=0,flag;
> 	int num[3001],abs[3001];
> 	scanf("%d",&n);
> 	for(i=0;i<n;i++)
> 		scanf("%d",&num[i]);
> 	for(i=0;i<n-1;i++)
> 	{
> 		if(num[i]>num[i+1])abs[i]=num[i]-num[i+1];
> 		else abs[i]=num[i+1]-num[i];
> 	}
> 	for(i=1;i<n;i++)
> 	{
> 		flag=0;
> 		for(j=0;j<n-1;j++)
> 		{
> 			if(i==abs[j])
> 			{
> 				flag=1;
> 				break;
> 			}
> 		}
> 		if(flag==1)sign++;
> 	}
> 	if(sign==n-1 || n==1)printf("Jolly\n");
> 	else printf("Not jolly\n");
> }

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