View Code of Problem 63

#include <iostream>
#include <string>
using namespace std;
struct boy {
	string name;
	int height;
	int money;
};
int main() {
	int n;
	int h, m;
	cin >> n;
	boy boys[n];
	for (int i=0; i<n; ++i) {
		cin >> boys[i].name >> boys[i].height >> boys[i].money;
		if ((boys[i].name).compare("Suxiao") == 0){
			h = boys[i].height;
			m = boys[i].money;
		}
	}
	int c1 = 0, c2 = 0;
	for (int i=0; i<n; ++i) {
		if (h > boys[i].height) ++c1;
		if (m > boys[i].money) ++c2;
	}
	if (c1 > c2) cout << "HEIGHT" << endl;
	else if (c1 < c2) cout << "MONEY" << endl;
	else cout << "EQ" << endl;
	return 0;
}

Double click to view unformatted code.


Back to problem 63