-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path10038.cpp
More file actions
36 lines (34 loc) · 750 Bytes
/
10038.cpp
File metadata and controls
36 lines (34 loc) · 750 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
using namespace std;
int main()
{
bool isJolly,jolly[3005];
int pre,now,n;
while(cin>>n)
{
fill_n(jolly,3005,false);
cin>>pre;
isJolly=true;
for(int i=1;i<n;i++)
{
cin>>now;
int v=abs(now-pre);
if(v<1||v>=n||jolly[v])
{
isJolly=false;
cout<<"Not jolly"<<endl;
for(int j=i+1;j<n;j++)
cin>>now;
break;
}
pre=now;
jolly[v]=true;
}
if(isJolly)
cout<<"Jolly"<<endl;
}
return 0;
}