View Code of Problem 63

#include<stdio.h>
#include<string.h>
typedef struct {
	char name[20];
	int height;
	int monye;
}stu;
int main()
{
	int n,i,j=0;
	int h,m,ch=0,cm=0;
	scanf("%d",&n);
	stu s[n];
	for(int i=0;i<n;i++)
	{
		scanf("%s%d%d",&s[i].name,&s[i].height,&s[i].monye);
	}
	for(i=0;i<n;i++)
	{
		if(strcmp(s[i].name,"Suxiao")==0)
		  {h=s[i].height;
		   m=s[i].monye;
		  }
	}
	for(i=0;i<n;i++)
	{
		if(h>s[i].height)ch++;
		if(m>s[i].monye)cm++;
	}

	if(ch>cm) printf("HEIGHT");
    if(ch<cm) printf("MONEY");
	if(ch==cm) printf("EQ");
}

Double click to view unformatted code.


Back to problem 63