求助!全RE
查看原帖
求助!全RE
657427
0Aurora0楼主2022/10/8 15:47
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
typedef long long ll;

struct Student {
	string name;
	int avg=0;
	int cla=0;
	char leader;
	char eastern;
	int num=0;
	int total = 0;
}STU[105];

bool cmp(Student& s1, Student& s2) {
	return s1.total >= s2.total;
}

int main(void)
{
	int N;
	cin >> N;
	ll mTotal = 0;
	for (int i = 0; i < N; ++i) {
		cin >> STU[i].name >> STU[i].avg >> STU[i].cla >> STU[i].leader >> STU[i].eastern >> STU[i].num;
		if (STU[i].avg > 80 && STU[i].num > 0)	STU[i].total += 8000;
		if (STU[i].avg > 85 && STU[i].cla > 80)	STU[i].total += 4000;
		if (STU[i].avg > 90)	STU[i].total += 2000;
		if (STU[i].avg > 85 && STU[i].eastern == 'Y')	STU[i].total += 1000;
		if (STU[i].cla > 80 && STU[i].leader =='Y')	STU[i].total += 850;
		mTotal += STU[i].total;
	}
	sort(STU, STU + N, cmp);
	cout << STU[0].name << endl;
	cout << STU[0].total << endl;
	cout << mTotal;
	return 0;
}
2022/10/8 15:47
加载中...