結果
| 問題 | No.355 数当てゲーム(2) | 
| コンテスト | |
| ユーザー |  kenji_shioya | 
| 提出日時 | 2016-06-07 22:51:10 | 
| 言語 | Java (openjdk 23) | 
| 結果 | 
                                RE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 1,353 bytes | 
| コンパイル時間 | 3,788 ms | 
| コンパイル使用メモリ | 79,288 KB | 
| 実行使用メモリ | 73,280 KB | 
| 平均クエリ数 | 11.35 | 
| 最終ジャッジ日時 | 2024-07-16 10:17:28 | 
| 合計ジャッジ時間 | 21,845 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 4 RE * 48 | 
ソースコード
import java.util.*;
public class Exercise67{
  public static void main (String[] args){
    Scanner sc = new Scanner(System.in);
    int[] q = {3, 2, 1, 0};
    whole: while(true){
      System.out.println(q[0] + " " + q[1] + " " + q[2] + " " + q[3]);
      System.out.flush();
      int p = sc.nextInt();
      int h = sc.nextInt();
      if (p == 4){
        break whole;
      }
      for (int i = 0; i < 4; i++){
        eachNum: for (int j = 0; j < 10; j++){
          if (checkMN(plus(q[i]), q)){
              q[i] = plus(q[i]);
              System.out.println("yes");
              continue;
          }else{
            q[i] = plus(q[i]);
            System.out.println(q[0] + " " + q[1] + " " + q[2] + " " + q[3]);
            System.out.flush();
            int pd = sc.nextInt();
            int hd = sc.nextInt();
            if (pd == 4){
              break whole;
            }else if(p + 1 == pd){
              p = pd;
              break eachNum;
            }
          }
        }
      }
    }
  }
  private static boolean checkMN(int num, int[] array){
    boolean flag = false;
    for (int i = 0; i < 4; i++){
      if (num == array[i]){
        flag = true;
      }
    }
    return flag;
  }
  private static int plus(int num){
    if (num < 9){
      num++;
    }else{
      num = 0;
    }
    return num;
  }
}
            
            
            
        