結果

問題 No.24 数当てゲーム
ユーザー koukonkokoukonko
提出日時 2015-12-07 13:31:01
言語 Java21
(openjdk 21)
結果
AC  
実行時間 44 ms / 5,000 ms
コード長 949 bytes
コンパイル時間 3,047 ms
コンパイル使用メモリ 74,084 KB
実行使用メモリ 51,208 KB
最終ジャッジ日時 2023-10-12 19:56:05
合計ジャッジ時間 4,531 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
49,260 KB
testcase_01 AC 43 ms
49,228 KB
testcase_02 AC 44 ms
49,732 KB
testcase_03 AC 43 ms
49,292 KB
testcase_04 AC 43 ms
49,300 KB
testcase_05 AC 44 ms
49,144 KB
testcase_06 AC 43 ms
51,208 KB
testcase_07 AC 42 ms
49,152 KB
testcase_08 AC 43 ms
49,252 KB
testcase_09 AC 43 ms
49,444 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		BufferedReader buff = new BufferedReader(new InputStreamReader(System.in));

		int[] flag = new int[10];

		try {
			int count = Integer.parseInt(buff.readLine());
			for (; count > 0; --count) {
				String[] box = buff.readLine().split(" ");
				int[] num = new int[4];
				for (int i = 0; i < 4; ++i) {
					num[i] = Integer.parseInt(box[i]);
				}

				int add = -1;
				if (box[4].equals("YES")) {
					add = 1;
				}
				for (int i = 0; i < 4; ++i) {
					flag[num[i]] += add;
				}
			}

			int max = -10;
			for (int i = 0; i < 10; ++i) {
				if (max < flag[i]) {
					max = flag[i];
				}
			}
			for (int i = 0; i < 10; ++i) {
				if (flag[i] == max) {
					System.out.println(i);
					break;
				}
			}
		} catch (NumberFormatException e) {

		} catch (IOException e) {

		}
	}
}
0