#include<iostream> #include<cstring> using namespace std; typedef struct Person { char name[40]; int height; int money; }Person; int main() { int N; scanf("%d", &N); Person persons[1000]; for (int i = 0; i < N; i++) { scanf("%s %d %d", &persons[i].name, &persons[i].height, &persons[i].money); } Person tmp1; for (int i = 0; i < N - 1; i++) { for (int j = 0; j < N - 1 - i; j++) { if (persons[j].height < persons[j + 1].height) { tmp1 = persons[j]; persons[j] = persons[j + 1]; persons[j + 1] = tmp1; } } } int h=0 ; for (int i = 0; i < N; i++) { if (strcmp(persons[i].name, "Suxiao") == 0) { h = i; break; } } Person tmp2; for (int i = 0; i < N - 1; i++) { for (int j = 0; j < N - 1 - i; j++) { if (persons[j].money < persons[j + 1].money) { tmp2 = persons[j]; persons[j] = persons[j + 1]; persons[j + 1] = tmp2; } } } int m=0 ; for (int i = 0; i < N; i++) { if (strcmp(persons[i].name, "Suxiao") == 0) { m = i; break; } } if (m < h) printf("MONEY\n"); else if (m > h) printf("HEIGHT\n"); else printf("EQ\n"); return 0; } |
Double click to view unformatted code.