solution.cpp 533 字节
Newer Older
每日一练社区's avatar
每日一练社区 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
#include <iostream>
using namespace std;
int main()
{
	struct student
	{
		string xm;
		int xh;
		double yy;
		double sx;
		double cpp;
	};
	student a[1000];
	int n;
	double sum = 0, min = 301, max = 0;
	string mins, maxs;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i].xm >> a[i].xh >> a[i].yy >> a[i].sx >> a[i].cpp;
		sum = a[i].yy + a[i].sx + a[i].cpp;
		if (min > sum)
		{
			min = sum;
			mins = a[i].xm;
		}
		if (max < sum)
		{
			max = sum;
			maxs = a[i].xm;
		}
	}
	cout << maxs << endl
		 << mins;
	return 0;
}