zoukankan      html  css  js  c++  java
  • hdu 5162 Jump and Jump...(水题)

    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 (1T100), indicating the number of test cases. For each test case: The first line contains an integer n (2n3), indicating the number of kids. For the next n lines, each line contains three integers ai,bi and ci (1ai,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
    2
    3
    10 10 10
    10 20 30
    10 10 20
    2
    3 4 1
    1 2 1
     
    Sample Output
    3 1 2
    1 2
     1 #include<cstdio>
     2 #include<cstring>
     3 #include<algorithm>
     4 using namespace std;
     5 int main()
     6 {
     7     int a,b,c,t,n,x[4],i,j,y[4];
     8     scanf("%d",&t);
     9     while (t--)
    10     {
    11         scanf("%d",&n);
    12         for (i=1;i<=n;i++)
    13         {
    14             scanf("%d%d%d",&a,&b,&c);
    15             x[i]=max(max(a,b),c);
    16         }
    17         memset(y,0,sizeof(y));
    18         for (i=1;i<=n;i++)
    19         {
    20             for (j=1;j<=n;j++)
    21             if (x[i]<x[j]) y[i]++;
    22         }
    23         for (i=1;i<n;i++) printf("%d ",y[i]+1);
    24         printf("%d
    ",y[n]+1);
    25     }
    26 }
  • 相关阅读:
    数据库中的左连接(left join)和右连接(right join)区别
    ajax提交form表单资料详细汇总
    javaScript 删除确认实现方法总结分享
    web.xml文件配置详解以及实例说明
    java时间处理工具类--DateUtils
    Oracle安装后忘记用户名或密码+创建新登陆用户
    zabbix server 端安装
    zabbix 介绍
    nginx + uWSGI 为 django 提供高并发
    nginx-1.10.3 编译安装
  • 原文地址:https://www.cnblogs.com/pblr/p/4801883.html
Copyright © 2011-2022 走看看