結果

問題 No.253 ロウソクの長さ
ユーザー koyoprokoyopro
提出日時 2015-10-07 18:43:42
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 614 bytes
コンパイル時間 1,182 ms
コンパイル使用メモリ 143,908 KB
実行使用メモリ 24,456 KB
平均クエリ数 31.83
最終ジャッジ日時 2023-09-23 06:33:47
合計ジャッジ時間 5,208 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
23,988 KB
testcase_01 AC 26 ms
23,928 KB
testcase_02 AC 27 ms
23,976 KB
testcase_03 AC 27 ms
23,952 KB
testcase_04 WA -
testcase_05 AC 29 ms
23,292 KB
testcase_06 AC 27 ms
23,328 KB
testcase_07 AC 27 ms
23,556 KB
testcase_08 AC 27 ms
23,340 KB
testcase_09 WA -
testcase_10 AC 28 ms
23,676 KB
testcase_11 AC 27 ms
24,216 KB
testcase_12 AC 28 ms
23,688 KB
testcase_13 AC 27 ms
23,400 KB
testcase_14 WA -
testcase_15 AC 27 ms
23,352 KB
testcase_16 AC 27 ms
23,352 KB
testcase_17 AC 27 ms
23,568 KB
testcase_18 AC 27 ms
23,340 KB
testcase_19 WA -
testcase_20 AC 27 ms
24,288 KB
testcase_21 AC 26 ms
24,300 KB
testcase_22 WA -
testcase_23 AC 26 ms
24,264 KB
testcase_24 AC 28 ms
23,472 KB
testcase_25 AC 26 ms
24,060 KB
testcase_26 AC 27 ms
23,556 KB
testcase_27 AC 27 ms
23,424 KB
testcase_28 AC 26 ms
23,424 KB
testcase_29 AC 27 ms
23,976 KB
testcase_30 AC 27 ms
23,964 KB
testcase_31 AC 27 ms
23,976 KB
testcase_32 AC 26 ms
23,664 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 27 ms
23,556 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;

#define REP(i, n) for(int i=0; i<(n); i++)

int ask(int Y){
    cout << "? " << Y << endl;
    int res;
    cin >> res;
    return res;
}
signed main()
{
    int high = (int)1e9;
    int low = 10;
    REP(i,100) {
        int mid = (high + low) / 2;
        int ret = ask(mid);
        if (ret == 0) {
            cout << "! " << max(mid, 0) + i << endl;
            return 0;
        }
        if (ret == 1) {
            low = mid;
        } else {
            high = mid;
        }
        high = max(0, high-1);
        low = max(0, low-1);
    }
    return 0;
}
0