View Code of Problem 63

#include<stdio.h>
#include<string.h>
typedef struct
{
	char name[20];
	int height;
	int money;
}Stu;
int main()
{
	Stu stu[1001];
	int n;
	int a=0;
	int b=0;
	int place;
	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 i=0;i<n;i++)
	{
		if(strcmp(stu[i].name,"Suxiao")==0)
		{
			place=i;
		}
	}
	for(int i=0;i<n;i++)
	{
		if(stu[place].height>stu[i].height)
			a++;	

	}
	for(int i=0;i<n;i++)
	{
		if(stu[place].money>stu[i].money)
			b++;		
	}

	if(a>b)
	{
		printf("HEIGHT\n");
	}
	else if(a<b)
	{
		printf("MONEY\n");		
	}
	else 
	{
		printf("EQ\n");		
	}
	return 0;
} 

Double click to view unformatted code.


Back to problem 63