View Code of Problem 63

#include <stdio.h>
#include <stdlib.h>
#include<ctype.h>
#include<string.h>
#include<math.h>
int main()
{
	int n, i, j, hight, money;
	struct MyStruct
	{
		char name[20];
		int hight, money;
	}a[1000];
	scanf("%d", &n);
	for (i = 0; i < n; i++)
	{
		scanf("%s%d%d", a[i].name, &a[i].hight, &a[i].money);
		if (strcmp(a[i].name, "Suxiao")==0)
		{
			j = i;
		}
	}
	hight = money = 0;
	for (i = 0; i < n; i++)
	{
		if (i == j)
			continue;
		if (a[i].hight > a[j].hight)
		{
			hight++;
		}
		if (a[i].money > a[j].money)
			money++;
	}
	if (hight < money)
		printf("HEIGHT");
	else if (hight > money)
		printf("MONEY");
	else printf("EQ");
	return 0;
}

Double click to view unformatted code.


Back to problem 63