View Code of Problem 63

#include<iostream>
#include<algorithm>
#include<math.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<cstring>
#include<string>
using namespace std;
struct stu{
	string name;
	int high;
	int money;
};
bool cmp1(stu s1,stu s2)
{
	return s1.high>s2.high;
}
bool cmp2(stu s1,stu s2)
{
	return s1.money>s2.money;
}
int main() {
    int n,len1=0,len2=0;
    while(cin>>n)
    {
    	stu s[n];
    	for(int i=0;i<n;i++)
    	cin>>s[i].name>>s[i].high>>s[i].money;
    	sort(s,s+n,cmp1);
    	for(int i=0;i<n;i++)
    	{
    		if(s[i].name!="Suxiao")
    		{
    			len1++;
			}
			else
			break;
    		
		}
		sort(s,s+n,cmp2);
    	for(int i=0;i<n;i++)
    	{
    		if(s[i].name!="Suxiao")
    		{
    			len2++;
			}
			else
			break;
    		
		}
		if(len1>len2)
		cout<<"MONEY";
		else if(len1<len2)
		cout<<"HEIGHT";
		else
		cout<<"EQ";
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 63