View Code of Problem 63

#include<stdio.h>
#include<algorithm>
#include<cstring>
using namespace std;
struct student{
	char name[20];
	int height;
	int money;
};
bool cmp(student a,student b){
	return a.height>b.height;
}
bool cmp2(student a,student b){
	return a.money>b.money;
}
int main(){
	int n;
	scanf("%d",&n);
	getchar();
		student s[n],s2[n];
		int i;
		for(i=0;i<n;i++){
			scanf("%s %d %d",s[i].name,&s[i].height,&s[i].money);
			
		}
		memcpy(s2,s,n);
		sort(s,s+n,cmp);
		sort(s2,s2+n,cmp2);
		int a,b;
		for(i=0;i<n;i++){
			if(s[i].name=="Suxiao"){
				a=i;
			}
		}
		for(i=0;i<n;i++){
			if(s2[i].name=="Suxiao"){
				b=i;
			}
		}
		if(a>b){
			printf("HEIGHT\n");
		}
		else if(a<b){
			printf("MONET\n");
			
		}
		else{
			printf("EQ\n");
		}
		
	
	
	
	
	return 0;
}

Double click to view unformatted code.


Back to problem 63