結果

問題 No.246 質問と回答
ユーザー めうめう🎒
提出日時 2016-03-30 10:29:12
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 51 ms / 2,000 ms
コード長 598 bytes
コンパイル時間 542 ms
コンパイル使用メモリ 72,564 KB
実行使用メモリ 25,220 KB
平均クエリ数 30.87
最終ジャッジ日時 2024-07-16 20:03:01
合計ジャッジ時間 3,530 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define ll long long
#define INF (1 << 30)
#define INFLL (1LL << 60)

ll ng = 1000000001,ok = 0,n,mid,re;

int main() {
	while(true){
		mid = (ng + ok) / 2;
		if(ng - 1 != ok){
			cout << "? " << mid << endl;
			cout.flush();
			cin >> re;
			if(re){
				ok = mid;
			}else{
				ng = mid;
			}
		}else{
			cout << "! " << ok << endl;
			cout.flush();
			break;
		}
	}
	return 0;
}
0