結果

問題 No.246 質問と回答
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-12-02 22:08:33
言語 Java21
(openjdk 21)
結果
AC  
実行時間 202 ms / 2,000 ms
コード長 577 bytes
コンパイル時間 2,185 ms
コンパイル使用メモリ 72,596 KB
実行使用メモリ 72,852 KB
平均クエリ数 30.90
最終ジャッジ日時 2023-09-23 20:19:08
合計ジャッジ時間 10,072 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 200 ms
72,284 KB
testcase_01 AC 194 ms
72,668 KB
testcase_02 AC 191 ms
71,760 KB
testcase_03 AC 193 ms
71,656 KB
testcase_04 AC 199 ms
72,444 KB
testcase_05 AC 195 ms
72,016 KB
testcase_06 AC 194 ms
72,200 KB
testcase_07 AC 202 ms
69,960 KB
testcase_08 AC 193 ms
72,040 KB
testcase_09 AC 198 ms
71,840 KB
testcase_10 AC 200 ms
72,392 KB
testcase_11 AC 200 ms
72,268 KB
testcase_12 AC 195 ms
72,452 KB
testcase_13 AC 193 ms
70,020 KB
testcase_14 AC 195 ms
72,056 KB
testcase_15 AC 195 ms
71,972 KB
testcase_16 AC 194 ms
72,388 KB
testcase_17 AC 195 ms
72,024 KB
testcase_18 AC 193 ms
72,556 KB
testcase_19 AC 196 ms
71,852 KB
testcase_20 AC 194 ms
72,076 KB
testcase_21 AC 192 ms
72,088 KB
testcase_22 AC 197 ms
71,872 KB
testcase_23 AC 197 ms
72,684 KB
testcase_24 AC 200 ms
71,748 KB
testcase_25 AC 198 ms
72,852 KB
testcase_26 AC 197 ms
72,204 KB
testcase_27 AC 195 ms
72,324 KB
testcase_28 AC 195 ms
71,708 KB
testcase_29 AC 196 ms
71,484 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int min=1;
        int max=1000000000;
        while(true){
            int mid=max-(max-min)/2;
            System.out.println("? "+mid);
            System.out.flush();
            int x = sc.nextInt();
            if(x==1){
                min=mid;
            }else{
                max=mid-1;
            }
            if(max==min){
                System.out.println("! "+max);
                break;
            }
        }
    }
}
0