結果

問題 No.246 質問と回答
ユーザー yuki2006
提出日時 2021-07-19 01:28:06
言語 Java
(openjdk 23)
結果
MLE  
実行時間 -
コード長 721 bytes
コンパイル時間 3,502 ms
コンパイル使用メモリ 76,404 KB
実行使用メモリ 468,532 KB
最終ジャッジ日時 2024-07-17 13:05:49
合計ジャッジ時間 15,408 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other MLE * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Yuki_Reactive {

    public Yuki_Reactive() {
        Scanner scanner = new Scanner(System.in);
        int[] dummy = new int[100000000];
        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