poj2575
简单题
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
#include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> using namespace std; #define maxn 3005 int n; bool vis[maxn]; bool ok(int a) { if (a < 0) a = -a; if (a >= n || a < 1) return false; if (vis[a]) return false; vis[a] = true; return true; } bool work() { bool ret = true; memset(vis, 0, sizeof(vis)); int a, b; scanf("%d", &a); for (int i = 1; i < n; i++) { scanf("%d", &b); if (ret && !ok(b - a)) ret = false; a = b; } return ret; } int main() { while (scanf("%d", &n) != EOF) if (work()) printf("Jolly\n"); else printf("Not jolly\n"); return 0; }