您的位置:首页 > 其它

NYOJ 60谁获得了最高奖学金

2016-10-17 23:40 447 查看
原题目链接

判断每种情况的获得奖金就行,水一下~

#include <iostream>
#include <string>
using namespace std;

struct student
{
string name;
int argEnd;
int argCls;
char isLeader;
char isWester;
int num;

int getAward()
{
int res = 0;
if(argEnd>80 && num>=1)
res+=8000;
if(argEnd>85 && argCls>80)
res+=4000;
if(argEnd>90)
res+=2000;
if(argEnd>85 && isWester=='Y')
res+=1000;
if(argCls>80 && isLeader=='Y')
res+=850;

return res;
}
};

int main()
{
student stu[110];
int t,n;
int res,all,maxid;

cin>>t;

while(t--){
cin>>n;
res=all=maxid=0;
for(int i=0;i<n;i++){
cin>>stu[i].name>>stu[i].argEnd>>stu[i].argCls>>stu[i].isLeader>>stu[i].isWester>>stu[i].num;
int price = stu[i].getAward();
if(price>res){
maxid = i;
res = price;
}
all+=price;
}
cout<<stu[maxid].name<<endl<<res<<endl<<all<<endl;
}

return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: