zoj 1879 Jolly Jumpers
2012-03-31 12:32
239 查看
#include "iostream" #include "memory.h" #include "cmath" using namespace std; int num[3010], ans[3010]; int main() { int n, i; bool tag; while (cin >> n) { tag = false; if (n == 1) { for (i = 1; i <= n; i++) cin >> num[i]; cout << "Jolly" << endl; } else { memset(num, 0, sizeof(num)); memset(ans, 0, sizeof(ans)); for (i = 1; i <= n; i++) cin >> num[i]; for (i = 1; i < n; i++) { int temp = abs (double(num[i+1] - num[i])); if (temp < 1 || temp > n) { tag = true; break; } ans[temp] = 1; } for (i = 1; i < n; i++) { if (ans[i] != 1) { tag = true; break; } } if (!tag) cout << "Jolly" << endl; else cout << "Not jolly" << endl; } } }
相关文章推荐
- POJ2575 ZOJ1879 UVA10038 Jolly Jumpers【序列】
- zoj 1879 Jolly Jumpers
- ZOJ 1879 Jolly Jumpers
- ZOJ 1879 — Jolly Jumpers(C++)
- zoj 1879 Jolly Jumpers
- ZOJ Problem Set–1879 Jolly Jumpers
- ZOJ 1879 Jolly Jumpers
- ZOJ 1879 Jolly Jumpers
- zoj 1879 || poj 2575 Jolly Jumpers(水~)
- zoj 1879 Jolly Jumpers
- ZOJ Problem Set - 1879
- ZOJ 1879
- zoj 1879
- POJ 2575 && ZOJ 1879 Jolly Jumper(整数序列)
- zoj1879
- UVa 10038 / POJ 2575 / ZOJ 1879 Jolly Jumpers (water ver.)
- ZOJ 1879题解 一道水题没啥好说的,代码贴在这,一开始WA了几次因为题意理解错误,只要报1到n-1每个数都出现一遍就行了
- 1879_Jolly Jumpers
- ZOJ-1879
- POJ-1625 & ZOJ-1540 & Ural-1158 AC自动机+DP+大数..