結果
| 問題 | No.24 数当てゲーム | 
| コンテスト | |
| ユーザー |  takeya_okino | 
| 提出日時 | 2017-06-12 08:28:09 | 
| 言語 | Java (openjdk 23) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 129 ms / 5,000 ms | 
| コード長 | 936 bytes | 
| コンパイル時間 | 2,121 ms | 
| コンパイル使用メモリ | 78,352 KB | 
| 実行使用メモリ | 54,044 KB | 
| 最終ジャッジ日時 | 2024-09-24 16:42:13 | 
| 合計ジャッジ時間 | 3,988 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 10 | 
ソースコード
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);
  }
}
            
            
            
        