poj 2575 Jolly Jumpers
2012-06-19 20:13
232 查看
//没有认真读题,WA了两次,因为他们的差值的顺序不一定需要按升序或者降序排列的!具体可以用下面的数据进行测试! #include<iostream> #include<cstring> #include<cmath> using namespace std; int dif[3000]; int main(){ int n; while(cin >> n){ memset(dif,0,sizeof(dif)); int pre,current; cin >> pre; int i; for(i = 1; i < n; i++){ cin >> current; int abs_dif = abs(current - pre); dif[abs_dif] = 1; pre = current; } for(i = 1; i < n; i++){ if(dif[i] == 0) break; } if(i == n) cout << "Jolly" << endl; else cout << "Not jolly" << endl; } } /* 4 6 3 2 0 1 2 2 2 2 3 1 2 3 3 3 2 1 4 4 4 4 4 */
相关文章推荐
- POJ 2575 Jolly Jumpers G++
- POJ 2575 && ZOJ 1879 Jolly Jumper(整数序列)
- (挑战编程_2_1)Jolly Jumpers
- poj 2575 Jolly Jumpers
- POJ 2575
- poj解题报告——poj 2575 Jolly Jumpers
- POJ 2575 Jolly Jumpers 解题报告
- POJ 2575
- POJ 2575 Jolly Jumpers(简单题)
- POJ 2575 Jolly Jumpers(我的水题之路——数组绝对差值为1到n-1)
- ZJUT-OJjolly jumpers
- POJ 2575 Jolly Jumpers(水~)
- poj2575-Jolly Jumpers
- POJ2575 Jolly Jumpers
- poj 2575 Jolly Jumpers
- POJ2575 Jolly Jumpers C语言
- poj 2575 Jolly Jumpers
- zoj 1879 || poj 2575 Jolly Jumpers(水~)
- poj 2575
- POJ-2575(用例能过,但一直WA)