結果

問題 No.246 質問と回答
コンテスト
ユーザー yuki2006
提出日時 2015-07-13 11:22:32
言語 Java
(openjdk 25.0.2)
コンパイル:
javac -encoding UTF8 _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true _class_
結果
WA  
実行時間 -
コード長 682 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,586 ms
コンパイル使用メモリ 83,488 KB
実行使用メモリ 62,580 KB
平均クエリ数 30.87
最終ジャッジ日時 2026-03-30 20:33:40
合計ジャッジ時間 7,875 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 30
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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 + 1);
        System.out.flush();

    }

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