Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main(){
- int n = 0, z = 0, k = 0, d = 0, l =0, count[3000], temp[3000], lol = 0;
- while(scanf("%d", &n) != EOF){
- for(z = 0; z < n; z++)
- scanf("%d", &count[z]);
- for(z = 0; z < n - 1; z++)
- temp[z] = count[z] - count[z+1];
- for(z = 0; z < n - 1; z++){
- if(temp[z] < 0)
- temp[z] *= -1;
- }
- d = n;
- for(z = 0; z < n; z++)
- for(k = d - 1; k >= 1; --k){
- if(temp[z] == k && temp[z-1] != k && temp[z+1] != k)
- lol++;
- }
- if(lol == d - 1){
- printf("Jolly\n");
- lol = 0;
- }
- else if(lol != d - 1){
- printf("Not jolly\n");
- lol = 0;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement