P1051正常做法 样例过 全WA
查看原帖
P1051正常做法 样例过 全WA
480675
CZero楼主2022/8/19 21:03

题目

#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
struct student
{
	string name;
	int av, cl, num, all;
	char work, west;
};
bool cmp(student x, student y)
{
	return x.all > y.all;
}
int main()
{
	int n, i, ans = 0;
	cin>> n;
	student a[n];
	for(i = 0; i < n; i++)
	{
		cin>> a[i].name>> a[i].av>> a[i].cl>> a[i].work>> a[i].west>> a[i].num;
		if(a[i].av > 80 && a[i].num >= 1)
		{
			a[i].all += 8000;
		}
		if(a[i].av > 85 && a[i].cl > 80)
		{
			a[i].all += 4000;
		}
		if(a[i].av > 90)
		{
			a[i].all += 2000;
		}
		if(a[i].av > 85 && a[i].west == 'Y')
		{
			a[i].all += 1000;
		}
		if(a[i].cl > 80 && a[i].work == 'Y')
		{
			a[i].all += 850;
		}
		ans += a[i].all;
	}
	sort(a, a + n, cmp);
	cout<< a[0].name<<endl;
	cout<< a[0].all<<endl;
	cout<< ans<<endl;

	return 0;
}
2022/8/19 21:03
加载中...