// UVa 10038 - Jolly Jumpers
#include <iostream>
#include <string.h>
#include <stdlib.h>
using namespace std;
int main() {
int n;
while (cin >> n) {
int a, b;
bool jolly = true;
bool yet[3000];
memset(yet, true, sizeof(yet));
cin >> b;
for (int i = 1; i < n; i++) {
a = b;
cin >> b;
int c = abs(b - a);
if (c < n && yet[c])
yet[c] = false;
else
jolly = false;
}
cout << (jolly ? "Jolly" : "Not jolly") << endl;
}
return 0;
}
when yet is the bool type variable, what does yet[c] mean ?
ReplyDelete