View Code of Problem 63

#include<iostream>
#include<string>
using namespace std;

int main() {
	int n, k, height[1000], money[1000], m, h;
	string name;
	k = h = m = 0;
	cin >> n;
	for(int i=0; i<n; i++) {
		cin >> name >> height[i] >> money[i];
		if(name == "Suxiao") 
			k = i;
	}
	for(int i=0; i<n; i++) {
		if(i != k) {
			if(height[i]>height[k])
				h++;
			if(money[i]>money[k])
				m++;
		}
	}
	if(h < n / 2)
		cout << "HEIGHT" << endl;
	else if(m < n / 2)
		cout << "MONEY" << endl;
	else
		cout << "EQ" << endl;
	return 0;
}

Double click to view unformatted code.


Back to problem 63