結果
問題 |
No.24 数当てゲーム
|
ユーザー |
|
提出日時 | 2016-07-18 17:28:47 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 57 ms / 5,000 ms |
コード長 | 954 bytes |
コンパイル時間 | 3,626 ms |
コンパイル使用メモリ | 77,844 KB |
実行使用メモリ | 50,208 KB |
最終ジャッジ日時 | 2024-10-15 16:59:16 |
合計ジャッジ時間 | 4,501 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
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(); } } }