杭电第5162题----jump jump
来源:互联网 发布:mac软件删除不彻底 编辑:程序博客网 时间:2024/06/05 09:35
Jump and Jump...
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 416 Accepted Submission(s): 280
Problem Description
There are n kids and they want to know who can jump the farthest. For each kid, he can jump three times and the distance he jumps is maximum distance amount all the three jump. For example, if the distance of each jump is (10, 30, 20), then the farthest distance he can jump is 30. Given the distance for each jump of the kids, you should find the rank of each kid.
Input
There are multiple test cases. The first line of input contains an integer T (1≤T≤100) , indicating the number of test cases. For each test case: The first line contains an integer n (2≤n≤3) , indicating the number of kids. For the next n lines, each line contains three integers ai,bi and ci (1≤ai,bi,ci,≤300 ), indicating the distance for each jump of the i -th kid. It's guaranteed that the final rank of each kid won't be the same (ie. the farthest distance each kid can jump won't be the same).
Output
For each test case, you should output a single line contain n integers, separated by one space. The i -th integer indicating the rank of i -th kid.
Sample Input
2310 10 1010 20 3010 10 2023 4 11 2 1
Sample Output
3 1 21 2HintFor the first case, the farthest distance each kid can jump is 10, 30 and 20. So the rank is 3, 1, 2.#include<stdio.h>int returnmax(int a,int b,int c){int max=a;if (max<b){max=b;}if (max<c){max=c;}return max;}int main(){int times,n,i,a,b,c,d,x,y,z;scanf("%d",×);while (times--){scanf("%d",&n);if (n==2){scanf("%d%d%d",&a,&b,&c);x=returnmax(a,b,c);scanf("%d%d%d",&a,&b,&c);y=returnmax(a,b,c);if (x>y){printf("1 2\n");}else{printf("2 1\n");}}if (n==3){scanf("%d%d%d",&a,&b,&c);x=returnmax(a,b,c);scanf("%d%d%d",&a,&b,&c);y=returnmax(a,b,c);scanf("%d%d%d",&a,&b,&c);z=returnmax(a,b,c);//printf("%d %d %d\n",x,y,z);if (x>y&&x>z&&y>z){printf("1 2 3\n");}else if (x>y&&x>z&&y<z){printf("1 3 2\n");}else if (y>x&&y>z&&x>z){printf("2 1 3\n");}else if (y>x&&y>z&&x<z){printf("3 1 2\n");}else if (z>x&&z>y&&x>y){printf("2 3 1\n");}else if (z>x&&z>y&&x<y){printf("3 2 1\n");}}}// int a=2,b=1,c=3;// printf("%d ",returnmax(a,b,c));}就是一个劲的判断,没啥的,这是大鸡吧说的!!----------------------------------------------------------201
0 0
- 杭电第5162题----jump jump
- Jump
- Jump
- Jump
- jump
- Jump
- jump
- Jump
- HDU 5162 Jump and Jump...
- hdu 5162 Jump and Jump...
- Jump and Jump... HDU 5162
- HDU 5162Jump and Jump...
- 【BestCoder】 HDOJ 5162 Jump and Jump...
- hdu 5162 Jump and Jump...(模拟)
- 1001Jump and Jump...
- 1001 Jump and Jump...
- Jump and Jump...
- About Jump
- 解决 windows 8.1 无线网络 连接受限
- 一行盒子,数组表示链表
- 汉诺塔递归结构
- 第五天工作总结
- Rotate Array
- 杭电第5162题----jump jump
- PRKP-1001,CRS-0215 rac 集群无法启动数据库和实例
- cocos2dx菜单重叠按钮实现按层优先选择及透明过滤
- 非递归遍历二叉树
- (蓝桥杯题)基础练习 矩形面积交
- 日志缓冲区(redo log buffer)及日志写进程(LGWR)剖析
- 开心的小明
- sizeof()用法汇总
- Android自定义组件ListView