結果

問題 No.246 質問と回答
コンテスト
ユーザー koba-e964
提出日時 2015-07-21 21:17:38
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 39 ms / 2,000 ms
コード長 373 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 406 ms
コンパイル使用メモリ 70,508 KB
実行使用メモリ 28,964 KB
平均クエリ数 31.87
最終ジャッジ日時 2026-03-31 09:09:42
合計ジャッジ時間 4,078 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>

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

using namespace std;
typedef long long int ll;



int main(void){
  ll a = 0, b = 2e9;
  while (b - a >= 2) {
    ll mid = (a + b) / 2;
    cout << "? " << mid << endl;
    int res;
    cin >> res;
    if (res) {
      a = mid;
    } else {
      b = mid;
    }
  }
  cout << "! " << a << endl;
}
0