P1001 谁拿了最多奖学金

题目有点长,慢慢读
#include
#include
using namespace std;

int main()
{
	int n, s1, s2, pa, sum, sum1=0,sum2=0;
	char xs, xb;
	string s, ss;
	while (cin >> n)
	{
		while (n--&&cin >> s >> s1 >> s2 >> xs >> xb >> pa)
		{
			sum = 0;
			if (s1 > 80 && pa >= 1)
				sum += 8000;
			if (s1 > 85 && s2 > 80)
				sum += 4000;
			if (s1 > 90)
				sum += 2000;
			if (s1 > 85 && xb == 'Y')
				sum += 1000;
			if (s2 > 80 && xs == 'Y')
				sum += 850;
			if (sum > sum1)
			{
				sum1 = sum;
				ss = s;
			}
			sum2 += sum;
		}
		cout << ss << endl << sum1 << endl << sum2 << endl;
	}
	return 0;
}



你可能感兴趣的:(Vijos)