| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
审题要注意了,关键词是take on all the values 1 through n-1,差的绝对值要取到1到n-1的所有值看了2眼以为差不大于n,果真我以为的只是我以为的。弱到爆~~~
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<string.h>
#include<algorithm>
#define N 3001
using namespace std;
int s[N];
int main()
{
int n,a,b,tmp,i;
while(scanf("%d",&n)!=EOF)
{
memset(s,0,sizeof(s));
b=0;
for(i=0;i<n;i++)
{
scanf("%d",&a);
tmp=abs(a-b);
s[tmp]=1;
b=a;
}
for(i=1;i<n;i++)
if(!s[i])break;
if(n==i)
puts("Jolly");
else
puts("Not jolly");
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator