Advertisement
JCLC

Untitled

May 18th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.65 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main(){
  5.     int n = 0, z = 0, k = 0, d = 0, l =0, count[3000], temp[3000], lol = 0;
  6.  
  7.     while(scanf("%d", &n) != EOF){
  8.  
  9.     for(z = 0; z < n; z++)
  10.         scanf("%d", &count[z]);
  11.  
  12.     for(z = 0; z < n - 1; z++)
  13.          temp[z] = count[z] - count[z+1];
  14.  
  15.     for(z = 0; z < n - 1; z++){
  16.         if(temp[z] < 0)
  17.           temp[z] *= -1;
  18.     }
  19.    
  20.     d = n;
  21.  
  22.     for(z = 0; z < n; z++)
  23.         for(k = d - 1; k >= 1; --k){
  24.             if(temp[z] == k && temp[z-1] != k && temp[z+1] != k)
  25.             lol++;
  26.     }
  27.  
  28.     if(lol == d - 1){
  29.        printf("Jolly\n");
  30.        lol = 0;
  31.     }
  32.     else if(lol != d - 1){
  33.        printf("Not jolly\n");
  34.        lol = 0;
  35.     }
  36.     }
  37.  
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement