結果

問題 No.246 質問と回答
ユーザー mastersatoshimastersatoshi
提出日時 2015-07-18 03:37:02
言語 Java21
(openjdk 21)
結果
AC  
実行時間 183 ms / 2,000 ms
コード長 587 bytes
コンパイル時間 2,571 ms
コンパイル使用メモリ 74,356 KB
実行使用メモリ 72,416 KB
平均クエリ数 30.90
最終ジャッジ日時 2023-09-23 20:00:25
合計ジャッジ時間 8,851 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 177 ms
72,164 KB
testcase_01 AC 174 ms
71,972 KB
testcase_02 AC 177 ms
70,100 KB
testcase_03 AC 176 ms
72,040 KB
testcase_04 AC 183 ms
72,052 KB
testcase_05 AC 180 ms
71,920 KB
testcase_06 AC 175 ms
71,592 KB
testcase_07 AC 175 ms
71,960 KB
testcase_08 AC 180 ms
71,492 KB
testcase_09 AC 179 ms
72,172 KB
testcase_10 AC 173 ms
72,104 KB
testcase_11 AC 174 ms
71,836 KB
testcase_12 AC 171 ms
70,088 KB
testcase_13 AC 173 ms
72,048 KB
testcase_14 AC 175 ms
72,344 KB
testcase_15 AC 173 ms
72,292 KB
testcase_16 AC 175 ms
71,672 KB
testcase_17 AC 183 ms
70,592 KB
testcase_18 AC 176 ms
72,416 KB
testcase_19 AC 170 ms
72,280 KB
testcase_20 AC 170 ms
71,712 KB
testcase_21 AC 172 ms
71,924 KB
testcase_22 AC 180 ms
71,984 KB
testcase_23 AC 177 ms
71,836 KB
testcase_24 AC 175 ms
71,824 KB
testcase_25 AC 175 ms
71,544 KB
testcase_26 AC 181 ms
72,336 KB
testcase_27 AC 175 ms
71,692 KB
testcase_28 AC 175 ms
71,520 KB
testcase_29 AC 176 ms
71,664 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main;

import java.util.*;

public class Main {

    public static void main(String[] args) {
        // TODO 自動生成されたメソッド・スタブ
        Scanner sc = new Scanner(System.in);
        int min = 1;
        int max = (int) 1e9;

        while (min + 1 != max) {

            int tmp = (min + max) / 2;
            System.out.println("? " + tmp);

            int t = sc.nextInt();

            if (t == 1) {
                min = tmp;
            } else {
                max = tmp;
            }
        }

        System.out.println("! " + min);
    }
}
0