結果

問題 No.24 数当てゲーム
コンテスト
ユーザー koukonko
提出日時 2015-12-07 13:31:01
言語 Java
(openjdk 25.0.2)
コンパイル:
javac -encoding UTF8 _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true _class_
結果
AC  
実行時間 30 ms / 5,000 ms
コード長 949 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,771 ms
コンパイル使用メモリ 80,996 KB
実行使用メモリ 39,040 KB
最終ジャッジ日時 2026-04-04 14:14:22
合計ジャッジ時間 2,520 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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