#include <iostream>
#include <algorithm>
using namespace std;
#define LL long long
const int MAXN = 100 + 5;
int n;
struct Stu{
int id;
string name;
LL end_score, class_score;
char form;
char west;
LL paper;
LL money = 0;
void input(){
cin >> name >> end_score >> class_score >> form >> west >> paper;
}
void output(){
cout << name << endl << money << endl;
}
} a[MAXN];
bool cmp(Stu x, Stu y){
if (x.money != y.money){
return x.money > y.money;
}
return x.id < y.id;
}
int main(){
cin >> n;
for (int i = 1;i <= n;i++){
a[i].input();
a[i].id = i;
}
LL sum = 0;
for (int i = 1;i <= n;i++){
if (a[i].end_score >= 80 && a[i].paper >= 1){
a[i].money += 8000;
}
if (a[i].end_score >= 85 && a[i].class_score >= 80){
a[i].money += 4000;
}
if (a[i].end_score >= 90){
a[i].money += 2000;
}
if (a[i].end_score >= 85 && a[i].west == 'Y'){
a[i].money += 1000;
}
if (a[i].class_score >= 80 && a[i].form == 'Y'){
a[i].money += 850;
}
}
sort(a + 1, a + n + 1, cmp);
for (int i = 1;i <= n;i++){
sum += a[i].money;
}
a[1].output();
cout << sum << endl;
return 0;
}
样例已过,自己测试的也过了,一评测就全WA