結果

問題 No.246 質問と回答
ユーザー koyumeishi
提出日時 2015-07-17 22:25:54
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 50 ms / 2,000 ms
コード長 461 bytes
コンパイル時間 677 ms
コンパイル使用メモリ 73,188 KB
実行使用メモリ 25,476 KB
平均クエリ数 30.90
最終ジャッジ日時 2024-07-16 19:37:51
合計ジャッジ時間 3,775 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cstdio>
#include <sstream>
#include <map>
#include <string>
#include <algorithm>
#include <queue>
#include <cmath>
#include <set>
using namespace std;

int main(){
	long long lb = 1;
	long long ub = 1e9 + 1;
	while(ub - lb > 1){
		long long mid = (lb+ub)/2;
		cout << "? " << mid << endl;
		int res;
		cin >> res;
		if(res == 1){
			lb = mid;
		}else{
			ub = mid;
		}
	}
	cout << "! " << lb << endl;
	return 0;
}
0