Advertisement
JCLC

Untitled

May 18th, 2016
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.61 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.     d = n;
  20.  
  21.     for(z = 0; z < n - 1; z++)
  22.         for(l = 0; l < z; l++)
  23.             if(temp[z] == temp[l]) lol++;
  24.  
  25.     if(lol == d - 1){
  26.        printf("Jolly\n");
  27.        lol = 0;
  28.     }
  29.     else if(lol != d - 1){
  30.        printf("Not jolly\n");
  31.        lol = 0;
  32.     }
  33.     }
  34.  
  35.     return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement