結果

問題 No.355 数当てゲーム(2)
ユーザー kenji_shioyakenji_shioya
提出日時 2016-06-07 23:02:00
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 1,525 bytes
コンパイル時間 3,554 ms
コンパイル使用メモリ 76,684 KB
実行使用メモリ 74,708 KB
平均クエリ数 23.81
最終ジャッジ日時 2023-09-23 10:47:41
合計ジャッジ時間 18,948 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 193 ms
72,940 KB
testcase_02 AC 196 ms
72,456 KB
testcase_03 AC 188 ms
72,980 KB
testcase_04 AC 188 ms
71,408 KB
testcase_05 AC 207 ms
73,208 KB
testcase_06 AC 191 ms
73,092 KB
testcase_07 AC 195 ms
72,776 KB
testcase_08 AC 195 ms
73,096 KB
testcase_09 RE -
testcase_10 AC 206 ms
70,748 KB
testcase_11 AC 213 ms
72,612 KB
testcase_12 AC 191 ms
71,020 KB
testcase_13 AC 196 ms
71,400 KB
testcase_14 RE -
testcase_15 AC 200 ms
72,764 KB
testcase_16 AC 217 ms
72,332 KB
testcase_17 RE -
testcase_18 AC 214 ms
71,268 KB
testcase_19 AC 190 ms
70,888 KB
testcase_20 AC 195 ms
73,124 KB
testcase_21 AC 194 ms
72,632 KB
testcase_22 RE -
testcase_23 AC 197 ms
73,008 KB
testcase_24 AC 195 ms
72,952 KB
testcase_25 RE -
testcase_26 AC 204 ms
72,896 KB
testcase_27 AC 187 ms
72,752 KB
testcase_28 AC 195 ms
72,748 KB
testcase_29 AC 205 ms
72,704 KB
testcase_30 RE -
testcase_31 RE -
testcase_32 AC 198 ms
72,220 KB
testcase_33 AC 195 ms
72,588 KB
testcase_34 AC 189 ms
70,556 KB
testcase_35 RE -
testcase_36 RE -
testcase_37 AC 196 ms
73,328 KB
testcase_38 AC 198 ms
70,480 KB
testcase_39 AC 198 ms
73,016 KB
testcase_40 AC 200 ms
73,232 KB
testcase_41 AC 195 ms
72,636 KB
testcase_42 AC 191 ms
73,252 KB
testcase_43 AC 205 ms
72,684 KB
testcase_44 AC 191 ms
71,204 KB
testcase_45 AC 214 ms
72,572 KB
testcase_46 AC 210 ms
71,428 KB
testcase_47 AC 206 ms
73,132 KB
testcase_48 AC 191 ms
72,644 KB
testcase_49 AC 188 ms
73,256 KB
testcase_50 AC 193 ms
72,648 KB
testcase_51 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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]);
              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;
            }else if(p - 1 == pd){
              if (q[i] > 0){
                q[i]--;
                break eachNum;
              }else{
                q[i] = 9;
                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;
  }
}
0