PC110201:Jolly Jumpers
来源:互联网 发布:网络交流 编辑:程序博客网 时间:2024/06/01 09:05
这道题的错误集中在下面几个。
1.循环结束条件判断。循环的时候有两个地方的循环条件弄错。
2.循环后运算弄错。到底是+1还是+2。
#include<stdio.h>#include<math.h>#include<memory.h>#define MAX 3000int main(){int num[MAX+1];int cha[MAX+1];int i;int n;int c;int jump;while(~scanf("%d",&n)){memset(num,0,sizeof(num));memset(cha,0,sizeof(cha));jump=0;for(i=0;i<n;i++)scanf("%d",&num[i]);for(i=0;i<n-1;i++){c=abs(num[i]-num[i+1]);if(c>n-1||cha[c]){printf("Not jolly\n");jump=1;break;}elsecha[c]=1;}if(jump==1)continue;for(i=1;i<n;i++)if(!cha[c]){printf("Not jolly\n");jump=1;break;}if(jump==0)printf("Jolly\n");}return 0;}
0 0
- PC110201:Jolly Jumpers
- Jolly Jumpers
- jolly jumpers
- PC110201 Jolly Jumper //水题,hash
- fjnu 1532 Jolly Jumpers
- fjnu 1591 Jolly Jumpers
- 1591Jolly Jumpers
- POJ2575 Jolly Jumpers
- UVa 10038 Jolly Jumpers
- uva10038 Jolly Jumpers
- poj 2575 Jolly Jumpers
- zoj 1879 Jolly Jumpers
- poj 2575 Jolly Jumpers
- ZOJ 1879 Jolly Jumpers
- 10038 - Jolly Jumpers
- UVa 10038 - Jolly Jumpers
- zoj 1879 Jolly Jumpers
- ZOJ 1879 Jolly Jumpers
- hibernate的运行流程
- 学学怎么提高你的网速
- Cocos2dx 中给模型替换多张不同贴图
- Cookie 和Session
- android NetworkTime set
- PC110201:Jolly Jumpers
- javaScript总结
- GET和POST的区别
- 亲测可行ie8与ie11共存方法支持win7x64等
- 程序设计
- LeetCode 378. Kth Smallest Element in a Sorted Matrix
- libcurl,sqllite,log4cpp,openssl交叉编译
- ARM 处理器寻址方式
- Error contacting service. It is probably not running.