結果

問題 No.246 質問と回答
ユーザー yuki2006yuki2006
提出日時 2015-07-13 11:23:00
言語 Java21
(openjdk 21)
結果
AC  
実行時間 202 ms / 2,000 ms
コード長 679 bytes
コンパイル時間 3,497 ms
コンパイル使用メモリ 74,312 KB
実行使用メモリ 56,628 KB
平均クエリ数 30.87
最終ジャッジ日時 2023-09-23 19:48:43
合計ジャッジ時間 11,452 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 202 ms
56,396 KB
testcase_01 AC 195 ms
56,288 KB
testcase_02 AC 195 ms
55,880 KB
testcase_03 AC 196 ms
55,984 KB
testcase_04 AC 193 ms
55,924 KB
testcase_05 AC 193 ms
55,664 KB
testcase_06 AC 196 ms
55,632 KB
testcase_07 AC 192 ms
56,252 KB
testcase_08 AC 194 ms
55,428 KB
testcase_09 AC 194 ms
56,120 KB
testcase_10 AC 195 ms
56,184 KB
testcase_11 AC 194 ms
55,136 KB
testcase_12 AC 197 ms
55,996 KB
testcase_13 AC 194 ms
56,628 KB
testcase_14 AC 195 ms
55,884 KB
testcase_15 AC 196 ms
55,604 KB
testcase_16 AC 196 ms
56,460 KB
testcase_17 AC 195 ms
55,352 KB
testcase_18 AC 195 ms
56,144 KB
testcase_19 AC 196 ms
56,064 KB
testcase_20 AC 195 ms
55,656 KB
testcase_21 AC 193 ms
55,496 KB
testcase_22 AC 192 ms
55,832 KB
testcase_23 AC 194 ms
55,656 KB
testcase_24 AC 195 ms
55,744 KB
testcase_25 AC 179 ms
55,652 KB
testcase_26 AC 196 ms
56,188 KB
testcase_27 AC 194 ms
56,108 KB
testcase_28 AC 193 ms
55,944 KB
testcase_29 AC 194 ms
55,812 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Yuki_Reactive {

    public Yuki_Reactive() {
        Scanner scanner = new Scanner(System.in);
        int A = 0;
        int B = (int) (1e+9) + 1;
        while (B - A > 1) {
            int c = (B + A) / 2;
            System.out.println("? " + c);
//            System.out.flush();
            final int response = scanner.nextInt();
            if (response == 1) {
                A = c;
            } else {
                B = c;
            }
        }
        System.out.println("! " + A );
        System.out.flush();

    }

    public static void main(String[] args) {
        Yuki_Reactive hoge = new Yuki_Reactive();
    }
}
0