View Code of Problem 63

#include<stdio.h>
#include<math.h>
#include<string.h>
struct student
{
	char name[20];
	int height;
	int money;
};
void main(){
	struct student stu[1000];
	int n,a,count1=0,count2=0;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
		scanf("%s %d %d",&stu[i].name,&stu[i].height,&stu[i].money);
	for(int j=0;j<n;j++)
		if(strcmp(stu[j].name,"Suxiao")==0)
		{a=j;break;}
	for(int m=0;m<n;m++){
		if(stu[a].height>stu[m].height)count1++;
		if(stu[a].money>stu[m].money)count2++;
	}
		if(count1>count2)
			printf("HEIGHT");
		else if(count1<count2)
			printf("MONEY");
		else
			printf("EQ");
}

Double click to view unformatted code.


Back to problem 63