結果

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

ソースコード

diff #

#include<iostream>
using namespace std;

int main(){
    int left = 0, right = 1e9+1, mid, res;
    cout << right << endl;
    while(left + 1 < right){
        int mid = (left+right)/2;
        cout << "? " << mid << flush;
        cin >> res;
        if(res == 1)        left = mid;
        else if(res == 0)   right = mid;
    }

    cout << "! " << left << endl;
    return 0;
}
0