- 谁拿了最多奖学金
- 2021-01-20 23:37:35 @
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<string>
const int E = 1e3 +10;
using namespace std;
int n, all_money;
struct stu
{
string name;
int soc1;
int soc2;
char post;
char west;
int pas;
int money = 0;
} a[E];
bool cmp(stu a, stu b)
{
return (a.money == b.money) ? (a.name > b.name) : (a.money > b.money);
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n;
for (int i=1; i<=n; i++)
{
cin >> a[i].name;
cin >> a[i].soc1 >> a[i].soc2;
cin >> a[i].post >> a[i].west;
cin >> a[i].pas;
}
for (int i=1; i<=n; i++)
{
if (a[i].soc1 > 80 && a[i].pas >= 1)
a[i].money += 8000;
if (a[i].soc1 > 85 && a[i].soc2 > 80)
a[i].money += 4000;
if (a[i].soc1 > 90)
a[i].money += 2000;
if (a[i].soc1 > 85 && a[i].west == 'Y')
a[i].money += 1000;
if (a[i].soc2 > 80 && a[i].post == 'Y')
a[i].money += 850;
all_money += a[i].money;
}
sort(a+1, a+n+1, cmp);
cout << a[1].name << endl << a[1].money << endl << all_money << endl;
return 0;
}
兄嘚集美们到底哪错了啊_____
1 条评论
-
周承阳 LV 0 @ 2021-01-24 11:34:16
第五行错了
- 1