- 谁拿了最多奖学金
- 2018-04-11 16:38:18 @
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
struct student
{
char name[40];
int ac_grade;
int cla_grade;
char isleader;
char iswest;
int papnum;
int money;
void cal();
};
void student::cal()
{
int money1=0;
if(ac_grade>80&&papnum>=1)
money1+=8000;
if(ac_grade>85&&cla_grade>80)
money1+=4000;
if(ac_grade>90)
money1+=2000;
if(ac_grade>85&&iswest=='Y')
money1+=1000;
if(cla_grade>80&&isleader=='Y')
money1+=850;
money=money1;
}
bool compare(const struct student &a,const struct student &b)
{
return a.money>b.money;
}
int main()
{
vector<struct student>stu;
struct student m;
int n;
while(cin>>n)
{
for(int i=0;i<n;i++)
{
cin>>m.name>>m.ac_grade>>m.cla_grade>>m.isleader>>m.iswest>>m.papnum;
m.cal();
stu.push_back(m);
}
sort(stu.begin(),stu.end(),compare);
cout<<stu[0].name<<endl<<stu[0].money<<endl;
int sum=0;
for(int i=0;i<n;i++)
sum+=stu[i].money;
cout<<sum<<endl;
}
return 0;
}