View Code of Problem 63

#include<stdio.h>
#include<string.h>
struct Student{
	char name[20];
	int height;
	int momey;
};
int main(){
	int n;
	scanf("%d",&n);
	struct Student stu[1000];
	int index,i;
	for( i=0;i<n;i++){
		scanf("%s%d%d",stu[i].name,&stu[i].height,&stu[i].momey);
		if(strcmp(stu[i].name,"Suxiao")==0){
			index=i;
		}
	}
	//先找到苏晓是第几个学生
	int shengao=0;
	int qian=0;
	for( i=0;i<n;i++){
		
			if(stu[index].height>stu[i].height){
				shengao++;
			}
			if(stu[index].momey>stu[i].momey){
				qian++;
			}
		
	} 
	if(shengao>qian){
		printf("HEIGHT\n");
	}else if(shengao<qian){
		printf("MONEY\n");
	}else{
		printf("EQ\n");
	}

	return 0;
}

Double click to view unformatted code.


Back to problem 63