View Code of Problem 63

#include<stdio.h>
#include<string.h>
struct student
{
	char name[20];
	int height;
	int money;
};
int main()
{
	struct student stu[1000];
	int n;
	scanf("%d",&n);
	int i;
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d",&stu[i].name,&stu[i].height,&stu[i].money);
	}
	int w;
	for(i=0;i<n;i++)
	{
		if(strcmp(stu[i].name,"Suxiao")==0)
		{
			w=i;
		}
	}
	int x=0,y=0;
	for(i=0;i<n;i++)
	{
		if(stu[i].height<stu[w].height)
		{
			x++;
		}
	}
	for(i=0;i<n;i++)
	{
		if(stu[i].money<stu[w].money)
		{
			y++;
		}
	}
	if(x>y)
	{
		printf("HEIGHT\n");
	}
	if(y>x)
	{
		printf("MONEY\n");
	}
	else
	{
		printf("EQ\n");
	}
	return 0;
} 

Double click to view unformatted code.


Back to problem 63