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)