https://www.luogu.com.cn/record/176047245
Code:
#include<bits/stdc++.h>
using namespace std;
struct stu{
string nm;
int pj,py,lw,q;
char gb,xb;
}st[101];
int n,sm=0;
bool cmp(stu a,stu b){
return a.q>b.q;
}
int main(){
cin>>n;
for(int i=1;i<=n;i++){
st[i].q=0;
cin>>st[i].nm>>st[i].pj>>st[i].py>>st[i].gb>>st[i].xb>>st[i].lw;
if(st[i].lw>0 && st[i].pj>80){
st[i].q+=8000;
}
if(st[i].py>80 && st[i].pj>85){
st[i].q+=4000;
}
if(st[i].pj>90){
st[i].q+=2000;
}
if(st[i].pj>85 && st[i].xb=='Y'){
st[i].q+=1000;
}
if(st[i].py>80 && st[i].gb=='Y'){
st[i].q+=850;
}
sm+=st[i].q;
}
sort(st+1,st+1+n,cmp);
cout<<st[1].nm<<endl;
cout<<st[1].q<<endl;
cout<<sm;
return 0;
}
#9我下载了样例,可是我在Shell里粘贴测试样例输入后,输出结果和测试样例的也一样,为什么测试有WA了呢?