Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define ll long long
- #define endl '\n'
- #define sz(x) int(x.size())
- #define all(x) x.begin(), x.end()
- int main() {
- ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
- int n = 0;
- while (cin >> n, n) {
- int prev, x;
- bool jolly = 1;
- bool vis[n]{};
- for (int i = 0; i < n; i++) {
- cin >> x;
- if (i > 0) {
- vis[abs(x - prev)] = 1;
- }
- prev = x;
- }
- for (int i = 1; i < n; i++) jolly &= vis[i];
- cout << (jolly ? "Jolly" : "Not jolly") << endl;
- n = 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement