結果

問題 No.246 質問と回答
ユーザー ミドリムシミドリムシ
提出日時 2018-02-11 07:25:07
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 420 bytes
コンパイル時間 869 ms
コンパイル使用メモリ 68,284 KB
実行使用メモリ 24,384 KB
平均クエリ数 30.53
最終ジャッジ日時 2023-09-23 15:39:41
合計ジャッジ時間 3,207 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
24,144 KB
testcase_01 WA -
testcase_02 AC 37 ms
23,712 KB
testcase_03 AC 37 ms
24,252 KB
testcase_04 AC 37 ms
23,664 KB
testcase_05 WA -
testcase_06 AC 35 ms
24,036 KB
testcase_07 AC 36 ms
23,400 KB
testcase_08 AC 35 ms
23,520 KB
testcase_09 WA -
testcase_10 AC 37 ms
24,036 KB
testcase_11 WA -
testcase_12 AC 34 ms
23,724 KB
testcase_13 AC 33 ms
23,256 KB
testcase_14 AC 36 ms
23,844 KB
testcase_15 WA -
testcase_16 AC 35 ms
23,712 KB
testcase_17 AC 33 ms
23,412 KB
testcase_18 AC 36 ms
23,664 KB
testcase_19 AC 35 ms
24,036 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 35 ms
23,280 KB
testcase_24 WA -
testcase_25 AC 38 ms
23,520 KB
testcase_26 AC 39 ms
23,532 KB
testcase_27 AC 37 ms
23,256 KB
testcase_28 AC 36 ms
23,280 KB
testcase_29 AC 40 ms
23,916 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
    int left = 0, right = 1e9;
    while(left + 1 < right){
        int middle = (left + right) / 2;
        cout << "? " << middle << endl;
        int reply;
        cin >> reply;
        if(reply){
            left = middle;
        }else{
            right = middle - 1;
        }
    }
    cout << "! " << left << endl;
}
0