Start: Mar, 06, 2018 09:46:00
计算机161 算法分析与设计 第一次实验课作业(吴银杰、张凯庆)
End: Mar, 10, 2018 10:00:00
Time elapsed:
Time remaining:

Problem_ID: F
Result: Accepted
Time: 570ms
Memory: 1716kB
Author: txd19980421
In contest: 1141

#include<iostream>
#include<algorithm> 
using namespace std;
typedef struct Student {
	string name;
	int total;
} student;
student st[105];
bool cmpare(const student &a, const student &b) {
	return a.total > b.total;
}
int main() {
	int T,N,t1,t2;
	cin>>T;
	while(T--) {
		cin>>N;
		for(int i=0; i<N; i++) {
			cin>>st[i].name>>t1>>t2;
			st[i].total=t1+t2;
		}
		sort(st, st + N, cmpare);
		for(int i=0; i<N; i++) {
			cout<<st[i].name<<endl;
		}
	}
	return 0;
}