View Code of Problem 63

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
struct student{
	char name[25];
	int height;
	int money;
}stu[1010];
bool cmp1(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);
	for(int i = 0;i < n;i++){
		scanf("%s%d%d", stu[i].name, &stu[i].height, &stu[i].money);
	}
	int h, m;
	sort(stu, stu+n, cmp1);
	for(int i = 0;i < n;i++){
		if(strcmp(stu[i].name, "Suxiao")==0){
			h = i;
			break;
		}
	}
	sort(stu, stu+n, cmp2);
	for(int i = 0;i < n;i++){
		if(strcmp(stu[i].name, "Suxiao")==0){
			m = i;
			break;
		}
	}
	if(h<m) printf("HEIGHT\n");
	else if(m<h) printf("MONEY\n");
	else printf("EQ\n");
 
	return 0;
}

Double click to view unformatted code.


Back to problem 63