View Code of Problem 63

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

	return 0;
}

Double click to view unformatted code.


Back to problem 63