結果

問題 No.246 質問と回答
ユーザー ミドリムシ
提出日時 2018-02-02 12:21:57
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 392 bytes
コンパイル時間 610 ms
コンパイル使用メモリ 64,008 KB
実行使用メモリ 25,928 KB
平均クエリ数 30.90
最終ジャッジ日時 2024-07-16 15:23:25
合計ジャッジ時間 4,411 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

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