代码如下:
#include <bits/stdc++.h>
long long n,m;
using namespace std;
struct f
{
string id,bg,west;
long long qm,py,lw,p=0,l;
} a[101];
int cmp(f x,f y)
{
if(x.p!=y.p) return x.p>y.p;
return x.l<y.l;
}
int jxj(f x)
{
int t=0;
if(x.qm>80&&x.lw>=1)
{
t+=8000;
}
if(x.qm>85&&x.py>80)
{
t+=4000;
}
if(x.qm>90)
{
t+=2000;
}
if(x.qm>85&&x.west=="Y")
{
t+=1000;
}
if(x.py>80&&x.bg=="Y")
{
t+=850;
}
return t;
}
int main()
{
cin>>n;
for(int i=0;i<n;i++)
{
cin>>a[i].id>>a[i].qm>>a[i].py>>a[i].bg>>a[i].west>>a[i].lw;
a[i].l=i;
a[i].p=jxj(a[i]);
m+=a[i].p;
}
sort(a,a+n,cmp) ;
cout<<a[0].id<<endl<<a[0].p<<endl<<m;
return 0;
}