View Code of Problem 63

#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
struct stu{
	string name;
	int height;
	int money; 
};
bool cmp1(stu x,stu y){
	return x.height>y.height;
}
bool cmp2(stu x,stu y){
	return x.money>y.money;
} 
int main(){
	int n,k1,k2;
	cin>>n;
	stu s[1001];
	for(int i=0;i<n;i++){
		cin>>s[i].name>>s[i].height>>s[i].money;
	} 
	sort(s,s+n,cmp1);
	for(int i=0;i<n;i++){
		if(s[i].name=="Suxiao")
		{
			k1=i;
		}
	}
	sort(s,s+n,cmp2);
	for(int i=0;i<n;i++){
		if(s[i].name=="Suxiao")
		{
			k2=i;
		}
	}
	if(k1==k2){
		cout<<"EQ"<<endl;
	}else if(k1<k2){
		cout<<"HEIGHT"<<endl;
	}else{
		cout<<"MONEY"<<endl;
	}
	return 0;
} 

Double click to view unformatted code.


Back to problem 63