View Code of Problem 63

#include<stdio.h>
#include<string.h>
#include<math.h>
struct student{

	char a[1000];
	int b;
	int c;
}s[100],aa;


int main(){
	
	int n,k;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
	
		scanf("%s",&s[i].a);
		scanf("%d",&s[i].b);
		scanf("%d",&s[i].c);
		
		if(strcmp(s[i].a,"Suxiao")==0)
		{
			k=i;
			aa.b=s[i].b;
			aa.c=s[i].c;
		}
	}
	int g=0,m=0;
	for(int j=0;j<n;j++){
		if(j!=k){
			if(s[j].b>aa.b)g++;
		
		}
		
		if(j!=k){
			if(s[j].c>aa.c)h++;
			
		}
	}
	
	if(m<g)printf("MONEY");
	else if(m>g)printf("HEIGHT");
	else printf("EQ");

}
/*
Main.c: In function 'main':
Main.c:18:3: warning: format '%s' expects argument of type 'char *', but argument 2 has type 'char (*)[1000]' [-Wformat=]
   scanf("%s",&s[i].a);
   ^
Main.c:37:19: error: 'h' undeclared (first use in this function)
    if(s[j].c>aa.c)h++;
                   ^
Main.c:37:19: note: each undeclared identifier is reported only once for each function it appears in
*/

Double click to view unformatted code.


Back to problem 63