- 谁拿了最多奖学金
- 2018-03-17 23:35:43 @
#include<iostream>
#include<algorithm>
using namespace std;
struct Student
{
string name;
int pjf,pyf,lws,jjs=0;//平均分、评议分、论文数、奖金数
char gb,xb;//干部、西部
};
Student stu[101];
bool cmp(Student a,Student b)
{
return a.jjs>=b.jjs;
}
int main()
{
int n,sum=0;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>stu[i].name>>stu[i].pjf>>stu[i].pyf>>stu[i].gb>>stu[i].xb>>stu[i].lws;
if(stu[i].pjf>80&&stu[i].lws>=1)
stu[i].jjs+=8000;
if(stu[i].pjf>85&&stu[i].pyf>80)
stu[i].jjs+=4000;
if(stu[i].pjf>90)
stu[i].jjs+=2000;
if(stu[i].pjf>85&&stu[i].xb=='Y')
stu[i].jjs+=1000;
if(stu[i].pyf>80&&stu[i].gb=='Y')
stu[i].jjs+=850;
sum+=stu[i].jjs;
}
sort(stu+1,stu+1+n,cmp);
cout<<stu[1].name<<endl<<stu[1].jjs<<endl<<sum;
return 0;
}