View Code of Problem 63

#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;
typedef struct pe
{
    string name;
    int h,m;
}pe;
bool cmp(pe a,pe b)
{
        return a.h >b.h;
}
bool cmp1(pe a,pe b)
{
    return a.m>b.m;
}
int main()
{
    int n;
    cin>>n;
    pe man[n];
    for(int i=0;i<n;++i)
    {
        cin>>man[i].name>>man[i].h>>man[i].m;
    }
    int money,height;
    sort(man,man+n,cmp);
    for(int i=0;i<n;++i)
    {
        if(man[i].name=="Suxiao")
        {
            height=i;
            break;
        }

    }
    sort(man,man+n,cmp1);
    for( int j=0;j<n;++j)
    {
        if(man[j].name=="Suxiao")
           {
               money =j;
               break;
           }
    }
    if(height>money)
        cout<<"MONEY";
    else if(height<money)
        cout<<"HEIGHT";
    else
        cout<<"EQ";



}

Double click to view unformatted code.


Back to problem 63