View Code of Problem 63

# include <stdio.h>
# include <string.h>
typedef struct
{
	char name[100];
	int height;
	int money;
}Info;

int main(void)
{
	Info info[10000];
	int  n  , height = 1 , money = 1 , i , j;
	scanf("%d",&n);
	for(i = 0 ; i < n ; i++)
		scanf("%s %d %d",&info[i].name,&info[i].height,&info[i].money);
	for(i = 0 ; i < n ; i++)	
		if(strcmp(info[i].name,"Suxiao") == 0 )
		{
			j = i ; 
			break;
		}	
	for(i = 0 ; i < n ; i++)
	{
		if(info[i].height > info[j].height)
			height++;
		if(info[i].money > info[j].money)	
			money++;
	}
	if(height > money)
		printf("MONEY\n");
	else if(height < money)
		printf("HEIGHT\n");
	else
		printf("EQ\n");
	return 0;
}

Double click to view unformatted code.


Back to problem 63