题目链接https://www.luogu.com.cn/problem/P1051
题记:题目的算法标签是排序,但其实按照题目模拟找出最大值即可。
#include<bits/stdc++.h>
using namespace std;
char name[25],str[25];
int a,b,e,ans;
char c,d;
int main(){
int n;
cin>>n;
int mmax=0,sum=0;
for(int i=0;i<n;i++){
int s=0;
cin>>str>>a>>b>>c>>d>>e;
if(a>80&&e>=1)s+=8000;
if(a>85&&b>80)s+=4000;
if(a>90)s+=2000;
if(a>85&&d=='Y')s+=1000;
if(b>80&&c=='Y')s+=850;
if(mmax<s){
mmax=s;
memset(name,0,sizeof(name));
strcpy(name,str);
}
sum+=s;
}
for(int i=0;i<strlen(name);i++)
cout<<name[i];
cout<<endl<<mmax<<endl<<sum<<endl;
return 0;
}