結果

問題 No.246 質問と回答
ユーザー Lay_ec
提出日時 2015-07-17 22:32:55
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 511 bytes
コンパイル時間 723 ms
コンパイル使用メモリ 78,984 KB
実行使用メモリ 25,520 KB
平均クエリ数 30.97
最終ジャッジ日時 2024-07-16 06:51:25
合計ジャッジ時間 4,089 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <sstream>
#include <map>
#include <queue>
#include <stack>

using namespace std;


int main()
{

	long long l=1,r=1000000000;
	
	while(l!=r){
		//cout<<"l="<<l<<" r="<<r<<endl;
		long long m=(l+r)/2;
		cout<<"? "<<m<<endl;
		int res;
		cin>>res;
		
		if(res) l=m+1;
		else r=m;
	}

	cout<<"! "<<l<<endl;

	return 0;
}
0