Title Link: http://acm.hdu.edu.cn/showproblem.php?pid=5162
The title means: There are n kid, each kid has three grades A, B, C. Pick one of the biggest results as the kid's final result. Then rank them according to each kid's final score.
The game is very ugly, this is more pleasing to the eye .... Oh
1#include <iostream>2#include <cstdio>3#include <cstdlib>4#include <cstring>5#include <algorithm>6 using namespacestd;7 8 Const intMAXN =5+2;9 structnodeTen { One intID; A intscore; - BOOL operator< (ConstNode &a)Const { - returnScore >A.score; the } - }KID[MAXN]; - intANS[MAXN]; - + intMain () - { + intT, N,inch; A while(SCANF ("%d", &t)! =EOF) { at while(t--) { -memset (ans,0,sizeof(ans)); -scanf"%d", &n); - for(inti =0; I < n; i++) { - intMaxx =-1; - for(intj =0; J <3; J + +) { inscanf"%d", &inch); -Maxx = Max (Maxx,inch); to } +Kid[i].id = i+1; -Kid[i].score =Maxx; the } *Sort (Kid, kid+n); $ for(inti =0; I < n; i++)Panax NotoginsengAns[kid[i].id] = i+1; - for(inti =1; I <= N; i++) theprintf"%d%c", ans[i], i = = n?'\ n':' '); + } A } the return 0; +}
BestCoder27 1001.Jump and jump ... (HDU 5162) Problem Solving report