結果

問題 No.246 質問と回答
コンテスト
ユーザー Haar
提出日時 2016-06-17 21:38:13
言語 C++11
(gcc 15.3.0 + boost 1.92.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 84 ms / 2,000 ms
+ 1µs
コード長 364 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 282 ms
コンパイル使用メモリ 75,216 KB
実行使用メモリ 9,520 KB
平均クエリ数 30.90
最終ジャッジ日時 2026-08-14 14:07:51
合計ジャッジ時間 2,585 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <string>
#include <iomanip>
using namespace std;

int main(){
	int max = 1000000000, min = 1, mid = (min + max) / 2;
	int res;
	
	while(max - min > 1){
		cout << "? " << mid << endl << flush;
		cin >> res;
		if(res){
			min = mid;
		}else{
			max = mid;
		}
		
		mid = (min + max) / 2;
	}
	cout << "! " << mid << endl;
	
	return 0;
}

0