#include<stdio.h> #include<malloc.h> #include<string.h> #include<math.h> typedef struct { char name[20]; int height; int money; }Person; int main() { int n; scanf("%d", &n); Person *a = (Person *)malloc(n * sizeof(Person)); int su_height,su_money; for (int i = 0;i < n;i++) { scanf("%s%d%d", a[i].name, &a[i].height, &a[i].money); if (strcmp(a[i].name, "Suxiao") == 0) { su_height = a[i].height; su_money = a[i].money; } } int monrank = 1, herank = 1; for (int i = 0;i < n;i++) { if (a[i].height > su_height) herank++; if (a[i].money > su_money) monrank++; } if (herank == monrank) printf("EQ\n"); else if (herank > monrank) printf("MONEY\n"); else printf("HEIGHT\n"); } |
Double click to view unformatted code.