View Code of Problem 63

import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Student[] student = new Student[n];
        int index = 0;
        for (int i = 0; i < n; i++) {
            student[i] = new Student(sc.next(), sc.nextInt(), sc.nextInt());
            if (student[i].name.equals("Suxiao"))
                index = i;
        }
        int heigetCount = 0;
        int moneyCount = 0;
        for (int i = 0; i < n; i++) {
            if (student[index].height > student[i].height)
                heigetCount++;
            if (student[index].money > student[i].money)
                moneyCount++;
        }
        if(heigetCount == moneyCount)
            System.out.println("EQ");
        if(heigetCount>moneyCount)
            System.out.println("HEIGHT");
        if(heigetCount<moneyCount)
            System.out.println("MONEY");
    }
}
 
class Student {
    String name;
    int height;
    int money;
 
    public Student() {
    }
 
    public Student(String name, int height, int money) {
        super();
        this.name = name;
        this.height = height;
        this.money = money;
    }
}

Double click to view unformatted code.


Back to problem 63