- 谁拿了最多奖学金
- 2017-10-07 20:03:19 @
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int maxn=105;
struct ty{
char name[25];
int ave;
int py;
bool gb=false;
bool xb=false;
int lw;
int money=0;
bool operator <(const ty b)const{
if(money==b.money){
int len=min(strlen(name),strlen(b.name));
for(int i=0;i<len;i++){
if(name[i]!=b.name[i])
return name[i]<b.name[i];
}
return strlen(name)<strlen(b.name);
}
return money>b.money;
}
}student[maxn],yx;
int sum=0;
void judge(ty &a){
if(a.ave>80&&a.lw>=1)
a.money+=8000;
if(a.ave>85&&a.py>80)
a.money+=4000;
if(a.ave>90)
a.money+=2000;
if(a.ave>85&&a.xb)
a.money+=1000;
if(a.py>80&&a.gb)
a.money+=850;
sum+=a.money;
return ;
}
int main() {
int n;
scanf("%d",&n);
for(int i=0;i<n;i++){
scanf("%s%d%d",student[i].name,&student[i].ave,&student[i].py);
getchar();
if(getchar()=='Y')
student[i].gb=true;
getchar();
if(getchar()=='Y')
student[i].xb=true;
scanf("%d",&student[i].lw);
judge(student[i]);
}
sort(student,student+n);
printf("%s\n%d\n%d\n",student[0].name,student[0].money,sum);
return 0;
}