結果

問題 No.246 質問と回答
ユーザー shi-moshi-mo
提出日時 2016-04-01 21:34:00
言語 D
(dmd 2.106.1)
結果
AC  
実行時間 47 ms / 2,000 ms
コード長 407 bytes
コンパイル時間 1,835 ms
コンパイル使用メモリ 135,768 KB
実行使用メモリ 24,372 KB
平均クエリ数 30.90
最終ジャッジ日時 2023-09-02 21:00:17
合計ジャッジ時間 5,384 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
23,664 KB
testcase_01 AC 44 ms
24,036 KB
testcase_02 AC 43 ms
24,312 KB
testcase_03 AC 42 ms
23,400 KB
testcase_04 AC 43 ms
23,448 KB
testcase_05 AC 43 ms
24,084 KB
testcase_06 AC 42 ms
24,048 KB
testcase_07 AC 43 ms
24,072 KB
testcase_08 AC 43 ms
23,568 KB
testcase_09 AC 43 ms
23,628 KB
testcase_10 AC 43 ms
23,388 KB
testcase_11 AC 42 ms
23,388 KB
testcase_12 AC 42 ms
23,448 KB
testcase_13 AC 42 ms
23,436 KB
testcase_14 AC 42 ms
23,436 KB
testcase_15 AC 42 ms
23,424 KB
testcase_16 AC 43 ms
24,036 KB
testcase_17 AC 43 ms
23,664 KB
testcase_18 AC 44 ms
24,324 KB
testcase_19 AC 43 ms
23,400 KB
testcase_20 AC 44 ms
24,372 KB
testcase_21 AC 43 ms
24,348 KB
testcase_22 AC 43 ms
23,388 KB
testcase_23 AC 41 ms
23,544 KB
testcase_24 AC 43 ms
23,400 KB
testcase_25 AC 42 ms
24,060 KB
testcase_26 AC 43 ms
23,424 KB
testcase_27 AC 42 ms
24,336 KB
testcase_28 AC 42 ms
23,856 KB
testcase_29 AC 40 ms
23,652 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio;
import std.string;
import std.math;
import std.conv;

enum MAX = 10 ^^ 9;

void main() {
    uint l = 1;
    uint u = MAX;

    while (l != u) {
        uint c = to!uint((0.5 * (u + l)).ceil);
        writef("? %s\n", c); stdout.flush;

        if ("1" == readln.strip) {
            l = c;
            continue;
        }
        u = c - 1;
    }
    writef("! %s\n", u); stdout.flush;
}
0