View Code of Problem 63

#include <iostream>
#include "map"
#include "string"

using namespace std;

/**
 * kkmd66 四刷
 * @return
 */
int main() {

    int N;
    cin >> N;

    //存储
    map<int, string> Height;
    map<int, string> Money;
    while (N--) {
        string name;
        int height, money;
        cin >> name >> height >> money;
        Height.insert(make_pair(height,name));
        Money.insert(make_pair(money,name));
    }

    //找优势
    int flag_height=0,flag_money=0;
    for(auto it:Height){
        if (it.second=="Suxiao")
            break;
        flag_height++;
    }
    for (auto it:Money) {
        if (it.second=="Suxiao")
            break;
        flag_money++;
    }

    //输出
    if (flag_height>flag_money)
        cout<<"HEIGHT";
    else if (flag_height<flag_money)
        cout<<"MONEY";
    else
        cout<<"EQ";

    return 0;
}

Double click to view unformatted code.


Back to problem 63