-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathuva-10038.c
More file actions
35 lines (27 loc) · 756 Bytes
/
uva-10038.c
File metadata and controls
35 lines (27 loc) · 756 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
#include <stdio.h>
#include <stdlib.h>
int main()
{
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
int n, i, j, sum, s, dif, is_same;
int *num;
while (scanf("%d", &n) != EOF) {
num = (int *) malloc(n * sizeof(int));
sum = 0;
is_same = 0;
for (i = 0, j = 0; i < n; i++) {
scanf("%d", &num[i]);
if (i > 0) {
dif = abs(num[i] - num[i - 1]);
sum += dif;
if (dif == 0) {
is_same = 1;
}
}
}
s = (n * (n - 1)) / 2;
sum == s && is_same == 0 ? printf("Jolly\n") : printf("Not jolly\n");
}
return 0;
}