結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー r.suzukir.suzuki
提出日時 2016-01-18 22:06:49
言語 Java21
(openjdk 21)
結果
AC  
実行時間 450 ms / 5,000 ms
コード長 1,025 bytes
コンパイル時間 3,419 ms
コンパイル使用メモリ 75,784 KB
実行使用メモリ 60,828 KB
最終ジャッジ日時 2023-09-08 14:42:59
合計ジャッジ時間 11,103 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 206 ms
58,992 KB
testcase_01 AC 436 ms
60,352 KB
testcase_02 AC 127 ms
56,008 KB
testcase_03 AC 131 ms
55,824 KB
testcase_04 AC 124 ms
56,048 KB
testcase_05 AC 450 ms
60,336 KB
testcase_06 AC 119 ms
56,076 KB
testcase_07 AC 121 ms
56,172 KB
testcase_08 AC 122 ms
56,580 KB
testcase_09 AC 120 ms
55,916 KB
testcase_10 AC 121 ms
56,436 KB
testcase_11 AC 120 ms
56,148 KB
testcase_12 AC 120 ms
55,864 KB
testcase_13 AC 124 ms
56,032 KB
testcase_14 AC 364 ms
60,192 KB
testcase_15 AC 302 ms
60,072 KB
testcase_16 AC 411 ms
60,292 KB
testcase_17 AC 271 ms
60,264 KB
testcase_18 AC 395 ms
60,828 KB
testcase_19 AC 356 ms
60,452 KB
testcase_20 AC 445 ms
60,756 KB
testcase_21 AC 189 ms
59,016 KB
testcase_22 AC 343 ms
60,672 KB
testcase_23 AC 438 ms
60,316 KB
testcase_24 AC 418 ms
60,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

enum Level {
	Lv1("1"), Lv2("2"), Lv3("3"), Lv4("4"), Lv5("5"), Lv6("6");
	int count;
	String name;

	Level(String s) {
		this.name = s;
	}

	public String toString() {
		return this.name;
	}

	static void vote(int i) {
		switch (i) {
		case 1:
			Lv1.count++;
			break;
		case 2:
			Lv2.count++;
			break;
		case 3:
			Lv3.count++;
			break;
		case 4:
			Lv4.count++;
			break;
		case 5:
			Lv5.count++;
			break;
		case 6:
			Lv6.count++;
			break;
		}
	}

	static Level judgment() {
		int i = -1;
		Level max = null;
		for (Level l : Level.values()) {
			if (i < l.count) {
				i = l.count;
				max = l;
			} else if (i == l.count) {
				if (Integer.parseInt(max.name) < Integer.parseInt(l.name)) {
					max = l;
				}
			}
		}
		return max;
	}
}

public class No_79 {

	public static void main(String[] args) {
		java.util.Scanner sc = new java.util.Scanner(System.in);
		int n = sc.nextInt();

		for (int i = 0; i < n; i++) {
			Level.vote(sc.nextInt());
		}

		System.out.println(Level.judgment());
		sc.close();

	}

}
0