View Code of Problem 63

#include<stdio.h>
#include<algorithm>
#include<cstring>
using namespace std;
struct student{
	char name[25];
	int height;
	int money;
}s[1000];
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);
		int i;
		for(i=0;i<n;i++){
			scanf("%s %d %d",s[i].name,&s[i].height,&s[i].money);

 		}
	
		sort(s,s+n,cmp);
		int a,b;
		for(i=0;i<n;i++){
			if(strcmp(s[i].name, "Suxiao")==0){
				a=i;
				break;
			}
		}
		sort(s,s+n,cmp2);
		for(i=0;i<n;i++){
			if(strcmp(s[i].name, "Suxiao")==0){
				b=i;
				break;
			}
		}
		if(a>b){
			printf("MONEY\n");
		}
		else if(a<b){
			printf("HEIGHT\n");
			
		}
		else{
			printf("EQ\n");
		}
		
	
	
	
	
	return 0;
}

Double click to view unformatted code.


Back to problem 63