View Code of Problem 63

#include <stdio.h>
#include <string.h>
int main(){
  int n;
  scanf("%d",&n);
  int a[1000];
  int s[1000];
  //char b[10]="Suxiao";
  int i,j=0,k=0,t,v,p,q;
  char name[30];
  int h,m,H,M,temp;
  for(i=0;i<n;i++){
    scanf("%s %d %d",&name,&h,&m);
    //getchar();
    if(strcmp(name,"Suxiao") == 0)
      H=h,M=m;
    a[j++]=h;
    s[k++]=m;
  }
  for(i=0;i<j;i++){
    for(p=i+1;p<j;p++){
      if(a[p]<a[i]){
        temp=a[i];
        a[i]=a[p];
        a[p]=temp;
      }
    }
  }
  for(i=0;i<k;i++){
    for(q=i+1;q<k;q++){
      if(s[q]<s[i]){
        temp=s[i];
        s[i]=s[q];
        s[q]=temp;
      }
    }
  }
  
  for(i=0;i<j;i++){
    if(a[i]==H)
      t=i;
  }
  for(i=0;i<k;i++){
    if(s[i]==M)
      v=i;
  }
  
  
  if(t>v)
    printf("HEIGHT\n");
  else if(t<v)
    printf("MONEY\n");
  else
    printf("EQ\n");
 
 
return 0;
}

Double click to view unformatted code.


Back to problem 63