forked from sitz/UVa-Online-Judge
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path10038.cpp
More file actions
49 lines (46 loc) · 675 Bytes
/
10038.cpp
File metadata and controls
49 lines (46 loc) · 675 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
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <bits/stdc++.h>
using namespace std;
bool flag[3010];
int main()
{
int n, value, rec;
while (cin >> n)
{
memset(flag, 0, sizeof(flag));
int loop;
for (loop = 0; loop < n; loop++)
{
cin >> value;
if (loop == 0)
{
flag[(int)fabs(value)] = true;
rec = value;
}
else
{
int temp;
temp = (int)fabs(value - rec);
if (temp <= 3000)
{
flag[temp] = true;
rec = value;
}
}
}
bool Joly = true;
for (loop = 1; loop < n; loop++)
{
if (flag[loop] == false)
{
cout << "Not jolly" << endl;
Joly = false;
break;
}
}
if (Joly)
{
cout << "Jolly" << endl;
}
}
return 0;
}