Hdu 5162 Jump ... (Water problem)

Source: Internet
Author: User

Problem Descriptionthere is 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 are maximum distance amount all the three jump. For example, if the distance of all is (ten, 30), then the farthest distance he can jump is. Given the distance for each jump of the kids, you should find the rank of each kid.

Inputthere is multiple test cases. The first line of input contains an integer T (1≤t≤) , 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 nextNLines, each line contains three integers ai,bi andcI (1≤ai,bi,ci,≤ ), indicating the distance for each jump of the i-th kid. It's guaranteed that's the final rank of each kid won ' t being the same (ie. the farthest distance each kid can jump won ' t be th e same).

Outputfor 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 Input2310 10 1010 20 3010 10 2023 4 11 2 1

Sample OUTPUT3 1 21 2

1#include <cstdio>2#include <cstring>3#include <algorithm>4 using namespacestd;5 intMain ()6 {7     inta,b,c,t,n,x[4],i,j,y[4];8scanf"%d",&t);9      while(t--)Ten     { Onescanf"%d",&n); A          for(i=1; i<=n;i++) -         { -scanf"%d%d%d",&a,&b,&c); thex[i]=Max (A, B), c); -         } -memset (Y,0,sizeof(y)); -          for(i=1; i<=n;i++) +         { -              for(j=1; j<=n;j++) +             if(X[i]<x[j]) y[i]++; A         } at          for(i=1; i<n;i++) printf ("%d", y[i]+1); -printf"%d\n", y[n]+1); -     } -}

Hdu 5162 Jump ... (Water problem)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.