fork download
  1. #include <stdio.h>
  2. #include <algorithm>
  3.  
  4. using namespace std;
  5.  
  6. int main (void){
  7. int n;
  8. while (scanf ("%d", &n)!=EOF){
  9. int vet1[n], vetdif1[n-1];
  10. int isJolly=1;
  11.  
  12. for (int i=0; i<n; i++){
  13. scanf ("%d",&vet1[i]);
  14. if (i!=0){
  15. vetdif1[i-1]=vet1[i]-vet1[i-1];
  16. if (vetdif1[i-1]<0){
  17. vetdif1[i-1]=vetdif1[i-1]*-1;
  18. }
  19. }
  20. }
  21. std::sort(vetdif1,vetdif1+n-1);
  22.  
  23. for (int i=0; i<n-1; i++){
  24. if (vetdif1[i]!=i+1){
  25. isJolly=0;
  26. }
  27. }
  28. if (isJolly)
  29. printf ("Jolly\n");
  30. else printf ("Not jolly\n");
  31. }
  32. return 0;
  33. }
  34.  
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
Standard output is empty