UVa 10038 - Jolly Jumpers
来源:互联网 发布:一汽大众待遇 知乎 编辑:程序博客网 时间:2024/05/20 14:26
每相邻的两个数之间求差,若这n个数的所有的差值正好满足1~(n-1),则输出“Jolly”,否则输出“Not Jolly”。
代码如下:
#include<iostream>#include<cstdio>#include<cstring>#include<cstdlib>#include<cmath>using namespace std;bool vis[3000];int a[3000], num;bool Judge(){ for(int i=1; i<num; i++) if(!vis[i]) return false; return true;}int main(){#ifdef test freopen("sample.txt", "r", stdin);#endif while(scanf("%d", &num) != EOF) { memset(vis, false, sizeof(vis[0])*num); scanf("%d", &a[0]); for(int i=1; i<num; i++) { scanf("%d", &a[i]); vis[abs(a[i]-a[i-1])] = true; } if(Judge()) printf("Jolly\n"); else printf("Not jolly\n"); } return 0;}
- UVa 10038 Jolly Jumpers
- UVa 10038 - Jolly Jumpers
- uva 10038 Jolly Jumpers
- UVa 10038 - Jolly Jumpers
- UVa 10038 - Jolly Jumpers
- UVa 10038 Jolly Jumpers
- UVa 10038 Jolly Jumpers
- UVa OJ 10038-Jolly Jumpers
- UVa OJ 10038 - Jolly Jumpers
- UVa Problem Solution: 10038 - Jolly Jumpers
- 10038 - Jolly Jumpers
- 10038 - Jolly Jumpers
- UVa Problem 10038 Jolly Jumpers (快乐的跳跃者)
- UVa 10038 / POJ 2575 / ZOJ 1879 Jolly Jumpers (water ver.)
- Jolly Jumpers
- jolly jumpers
- UvaOJ 10038 - Jolly Jumpers 题解以及代码
- fjnu 1532 Jolly Jumpers
- 低价高配,100%互联网手机如何颠覆市场格局?
- PostgreSQL的热备和恢复(转帖)
- 过安全狗技术总汇
- 更新document新版本的内容
- 什么是ITIL
- UVa 10038 - Jolly Jumpers
- 建站之星最新0DAY
- 教你如何做面霸--面试题目及考察要点
- win7下利用VM8安装CentOS6.3配置静态IP上网
- 代码覆盖率-clover- 介绍
- 中文分词
- 最土团购网盲注n枚
- GridView 72般绝技
- 选项卡