View Code of Problem 63

#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
using namespace std;

int main(){
    int n;
    int s_height,s_money;
    int height[1000];
    int money[1000];
    char name[20];
    int h,m;
    scanf("%d",&n);
    for(int i =0;i<n;i++)
    {
        scanf("%s",name);
        scanf("%d",&height[i]);
        scanf("%d",&money[i]);
        if(strcmp(name,"Suxiao"))
        {
            s_height = height[i];
            s_money = money[i];
        }
    }
    sort(money,money+n);
    sort(height,height+n);
    for(int i = 0;i<n;i++)
    {
        if(height[i] == s_height)
            h = i;
        if(money[i] == s_money)
            m = i;
    }
    if(m == h)
        printf("EQ\n");
    else if(m>h)
        printf("MONEY\n");
    else
    {
        printf("HEIGHT\n");
    }
    
    return 0;
}

Double click to view unformatted code.


Back to problem 63