結果

問題 No.246 質問と回答
ユーザー mamekin
提出日時 2016-02-06 01:47:41
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 54 ms / 2,000 ms
コード長 690 bytes
コンパイル時間 1,063 ms
コンパイル使用メモリ 91,128 KB
実行使用メモリ 25,460 KB
平均クエリ数 30.90
最終ジャッジ日時 2024-07-16 19:59:54
合計ジャッジ時間 4,414 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

int main()
{
    int a = 1;
    int b = 1000000000;
    while(a < b){
        int y = (a + b + 1) / 2;
        cout << "? " << y << endl;

        int res;
        cin >> res;
        if(res == 0)
            b = y - 1;
        else
            a = y;
    }
    cout << "! " << a << endl;

    return 0;
}
0