結果

問題 No.24 数当てゲーム
ユーザー jimanojimano
提出日時 2016-07-18 17:28:47
言語 Java21
(openjdk 21)
結果
AC  
実行時間 58 ms / 5,000 ms
コード長 954 bytes
コンパイル時間 3,511 ms
コンパイル使用メモリ 76,276 KB
実行使用メモリ 37,264 KB
最終ジャッジ日時 2024-04-23 16:30:19
合計ジャッジ時間 4,658 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
37,160 KB
testcase_01 AC 53 ms
36,848 KB
testcase_02 AC 54 ms
36,968 KB
testcase_03 AC 53 ms
37,064 KB
testcase_04 AC 55 ms
36,984 KB
testcase_05 AC 54 ms
37,264 KB
testcase_06 AC 54 ms
37,076 KB
testcase_07 AC 54 ms
37,196 KB
testcase_08 AC 58 ms
36,924 KB
testcase_09 AC 53 ms
36,844 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class No0024 {
	public static void main(String[] args) {
		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
			int cntTurn = Integer.parseInt(br.readLine());
			String[] str;
			int collectCnt = 0;
			int[] num = new int[10];

			for (int i = 0; i < cntTurn; i++) {
				str = br.readLine().trim().split(" ");
				if (str[str.length - 1].endsWith("NO")) {
					for (int j = 0; j < str.length - 1; j++) {
						num[Integer.parseInt(str[j])] = -1;// リセット
					}
				} else if (str[str.length - 1].endsWith("YES")) {
					for (int j = 0; j < str.length - 1; j++) {
						num[Integer.parseInt(str[j])] += 1;
					}
					collectCnt++;
				}
			}
			for (int i = 0; i < num.length; i++) {
				if (num[i] == collectCnt) {
					System.out.println(i);
				}
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
0