結果

問題 No.246 質問と回答
ユーザー mastersatoshimastersatoshi
提出日時 2015-07-18 03:22:11
言語 Java21
(openjdk 21)
結果
AC  
実行時間 202 ms / 2,000 ms
コード長 555 bytes
コンパイル時間 2,063 ms
コンパイル使用メモリ 77,184 KB
実行使用メモリ 70,568 KB
平均クエリ数 30.90
最終ジャッジ日時 2024-07-16 19:48:21
合計ジャッジ時間 9,575 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 187 ms
57,568 KB
testcase_01 AC 184 ms
58,388 KB
testcase_02 AC 179 ms
58,120 KB
testcase_03 AC 193 ms
58,072 KB
testcase_04 AC 202 ms
58,616 KB
testcase_05 AC 187 ms
57,124 KB
testcase_06 AC 181 ms
58,408 KB
testcase_07 AC 183 ms
57,748 KB
testcase_08 AC 196 ms
58,068 KB
testcase_09 AC 184 ms
58,112 KB
testcase_10 AC 181 ms
58,536 KB
testcase_11 AC 178 ms
69,640 KB
testcase_12 AC 183 ms
57,896 KB
testcase_13 AC 195 ms
58,692 KB
testcase_14 AC 184 ms
58,152 KB
testcase_15 AC 184 ms
58,180 KB
testcase_16 AC 181 ms
57,848 KB
testcase_17 AC 183 ms
57,664 KB
testcase_18 AC 180 ms
57,604 KB
testcase_19 AC 178 ms
57,944 KB
testcase_20 AC 183 ms
70,568 KB
testcase_21 AC 183 ms
57,092 KB
testcase_22 AC 196 ms
58,204 KB
testcase_23 AC 182 ms
58,548 KB
testcase_24 AC 178 ms
69,856 KB
testcase_25 AC 182 ms
57,232 KB
testcase_26 AC 194 ms
57,532 KB
testcase_27 AC 198 ms
58,176 KB
testcase_28 AC 182 ms
58,264 KB
testcase_29 AC 177 ms
69,692 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main;

import java.util.*;

public class Main {

    public static void main(String[] args) {
        // TODO 自動生成されたメソッド・スタブ
        Scanner sc = new Scanner(System.in);
        int a = 1;
        int b = (int) 1e9;
        while (a < b - 1) {
            int c = (a + b) / 2;
            System.out.println("? " + c);
            int t = sc.nextInt();
            if (t == 1) {
                a = c;
            } else {
                b = c;
            }
        }
        System.out.println("! " + a);
    }
}
0