#include<stdio.h> #include<string.h> #include<math.h> struct ssz { char name[100]; int height; int money; }; int main() { int temp,j; int n,xx,yy; int i; char a[100]; struct ssz xs[1000]; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%s %d %d",&xs[i].name,&xs[i].height,&xs[i].money); } for(i=1;i<n;i++) { for(j=n-1;j>=i;j--) { if(xs[j].height>xs[j-1].height) { temp=xs[j].height; xs[j].height=xs[j-1].height; xs[j-1].height=temp; temp=xs[j].money; xs[j].money=xs[j-1].money; xs[j-1].money=temp; strcpy(a,xs[j].name); strcpy(xs[j].name,xs[j-1].name); strcpy(xs[j-1].name,a); } } } xx=0; for(i=0;i<n;i++) { if(strcmp(xs[i].name,"Suxiao")!=0) { xx++; } else break; } for(i=1;i<n;i++) { for(j=n-1;j>=i;j--) { if(xs[j].money>xs[j-1].money) { temp=xs[j].height; xs[j].height=xs[j-1].height; xs[j-1].height=temp; temp=xs[j].money; xs[j].money=xs[j-1].money; xs[j-1].money=temp; strcpy(a,xs[j].name); strcpy(xs[j].name,xs[j-1].name); strcpy(xs[j-1].name,a); } } } yy=0; for(i=0;i<n;i++) { if(strcmp(xs[i].name,"Suxiao")!=0) { yy++; } else break; } if(xx==yy) { printf("EQ\n"); } else if(xx<yy) { printf("HEIGHT\n"); } else { printf("MONEY\n"); } } |
Double click to view unformatted code.