来自New Bing的题解
2023-04-01 21:15:34
发布于:澳大利亚
22阅读
0回复
0点赞
#include <iostream>
#include <cstring>
using namespace std;
const int N = 110;
struct Student
{
string name;
int score1;
int score2;
char leader;
char west;
int paper;
int money;
}stu[N];
int n;
int getMoney(Student s)
{
int money = 0;
if(s.score1 > 80 && s.paper >= 1) money += 8000;
if(s.score1 > 85 && s.score2 > 80) money += 4000;
if(s.score1 > 90) money += 2000;
if(s.score1 > 85 && s.west == 'Y') money += 1000;
if(s.score2 > 80 && s.leader == 'Y') money += 850;
return money;
}
int main()
{
cin >> n;
Student maxs = {"", -1, -1, 'N', 'N', -1, -1};
int sum = 0;
for(int i = 0; i < n; i ++)
{
cin >> stu[i].name >> stu[i].score1 >> stu[i].score2 >> stu[i].leader >> stu[i].west >> stu[i].paper;
stu[i].money = getMoney(stu[i]);
sum += stu[i].money;
if(stu[i].money > maxs.money) maxs = stu[i];
}
cout << maxs.name << endl << maxs.money << endl << sum << endl;
return 0;
}
这里空空如也
有帮助,赞一个