結果

問題 No.24 数当てゲーム
ユーザー suiginginsuigingin
提出日時 2015-07-07 22:02:32
言語 Java19
(openjdk 21)
結果
AC  
実行時間 124 ms / 5,000 ms
コード長 709 bytes
コンパイル時間 4,865 ms
コンパイル使用メモリ 78,136 KB
実行使用メモリ 55,928 KB
最終ジャッジ日時 2023-09-22 09:22:02
合計ジャッジ時間 5,371 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,924 KB
testcase_01 AC 120 ms
55,928 KB
testcase_02 AC 121 ms
55,696 KB
testcase_03 AC 122 ms
55,692 KB
testcase_04 AC 120 ms
55,752 KB
testcase_05 AC 120 ms
55,568 KB
testcase_06 AC 121 ms
55,828 KB
testcase_07 AC 124 ms
55,568 KB
testcase_08 AC 123 ms
55,896 KB
testcase_09 AC 124 ms
55,616 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;

public class No_024 {
	Scanner sc = new Scanner(System.in);

	void run() {
		int N = sc.nextInt();
		int[] cnt = new int[10];
		while (N-- > 0) {
			int[] n = { sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt() };
			if (sc.next().equals("YES")) {
				for (int j = 0; j < 4; j++) {
					if (cnt[n[j]] != -1) cnt[n[j]]++;
				}
			} else {
				for (int j = 0; j < 4; j++) {
					cnt[n[j]] = -1;
				}
			}
		}
		int max = -100;
		int maxIndex = 0;
		for (int i = 0; i < 10; i++) {
			if (max < cnt[i]) {
				max = cnt[i];
				maxIndex = i;
			}
		}
		System.out.println(maxIndex);
	}

	public static void main(String[] args) {
		new No_024().run();
	}
}
0