結果

問題 No.305 鍵(2)
ユーザー kenji_shioyakenji_shioya
提出日時 2016-06-02 05:16:56
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 1,465 bytes
コンパイル時間 3,322 ms
コンパイル使用メモリ 74,788 KB
実行使用メモリ 67,852 KB
平均クエリ数 3.77
最終ジャッジ日時 2023-09-23 10:46:20
合計ジャッジ時間 7,062 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 AC 67 ms
65,256 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;

public class Exercise47{
  public static void main (String[] args) throws IOException{

    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

    String nums = "0000000000";
    String[] numArray = nums.split("");

    a: for (int a = 0; a < 10; a++){
      b: for (int b = 0; b < 10; b++){
        System.out.println(nums);
        String result = new String(in.readLine());

        int resultBeforeNum = getAnswer(result);
        if (resultBeforeNum == 10){
          break a;
        }

        int currentNum = Integer.parseInt(numArray[a]);
        int changedNum = currentNum + 1;
        System.out.println(changedNum);
        numArray[a] = String.valueOf(changedNum);
        System.out.println(numArray[a]);

        nums = "";
        for (int n = 0; n < 10; n++){
          nums += numArray[n];
        }

        System.out.println(nums);

        result = new String(in.readLine());
        int resultAfterNum = getAnswer(result);

        if (resultAfterNum == 10){
          break a;
        }else if (resultAfterNum > resultBeforeNum){
          break b;
        }else if (resultAfterNum < resultBeforeNum){
          numArray[a] = String.valueOf(currentNum);
          break b;
        }
      }
    }
  }
  public static int getAnswer(String result){

    String[] resultArray = result.split(" ");

    int resultNum = Integer.parseInt(resultArray[0]);
    return resultNum;
  }
}
0