vijos p1001 谁拿了最多奖学金
自答:23ms 500.0 KiB
#include<iostream>
#include<string>
using namespace std;
class student {
public:
string name;
int averMark;
int classMark;
char cadre;
char west;
int papers;
int money;
};
int main()
{
student a[100];
int max = 0;
int sum = 0;
int n;
cin >> n;
for (int i = 0; i < n; i++)
cin >> a[i].name >> a[i].averMark >> a[i].classMark >> a[i].cadre >> a[i].west >> a[i].papers;
for (int j = 0; j < n; j++)
{
a[j].money = 0;
if (a[j].averMark > 80 && a[j].papers >= 1)
a[j].money += 8000;
if (a[j].averMark > 85 && a[j].classMark > 80)
a[j].money += 4000;
if (a[j].averMark > 90)
a[j].money += 2000;
if (a[j].averMark > 85 && a[j].west == 'Y')
a[j].money += 1000;
if (a[j].classMark > 80 && a[j].cadre == 'Y')
a[j].money += 850;
sum += a[j].money;
}
for (int k = 0; k < n; k++)
{
if (a[k].money > a[max].money)
max = k;
}
cout << a[max].name << endl;
cout << a[max].money << endl;
cout << sum;
return 0;
}