結果

問題 No.24 数当てゲーム
ユーザー takeya_okinotakeya_okino
提出日時 2017-06-12 08:28:09
言語 Java21
(openjdk 21)
結果
AC  
実行時間 134 ms / 5,000 ms
コード長 936 bytes
コンパイル時間 2,309 ms
コンパイル使用メモリ 78,276 KB
実行使用メモリ 57,604 KB
最終ジャッジ日時 2023-10-24 21:30:05
合計ジャッジ時間 4,328 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
57,352 KB
testcase_01 AC 131 ms
57,356 KB
testcase_02 AC 131 ms
57,460 KB
testcase_03 AC 134 ms
57,376 KB
testcase_04 AC 131 ms
57,364 KB
testcase_05 AC 131 ms
57,336 KB
testcase_06 AC 132 ms
57,464 KB
testcase_07 AC 134 ms
57,604 KB
testcase_08 AC 128 ms
57,292 KB
testcase_09 AC 132 ms
57,356 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    ArrayList[] arr = new ArrayList[N];
    int[] res = new int[N];
    for(int i = 0; i < N; i++) {
      ArrayList<Integer> list = new ArrayList<Integer>();
      list.add(sc.nextInt());
      list.add(sc.nextInt());
      list.add(sc.nextInt());
      list.add(sc.nextInt());
      arr[i] = list;
      String r = sc.next();
      if(r.equals("YES")) {
        res[i] = 1; 
      }
    }
    int ans = 0;
    for(int i = 0; i < 10; i++) {
      boolean flg = true;
      for(int j = 0; j < N; j++) {
        ArrayList<Integer> list = arr[j];
        if(list.contains(i)) {
          if(res[j] == 0) flg = false;
        } else {
          if(res[j] == 1) flg = false;
        }
      }
      if(flg) {
        ans = i;
        break;
      }
    }
    System.out.println(ans);
  }
}
0