結果

問題 No.246 質問と回答
ユーザー RIGIHRIGIH
提出日時 2017-07-19 13:45:41
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 42 ms / 2,000 ms
コード長 781 bytes
コンパイル時間 521 ms
コンパイル使用メモリ 64,748 KB
実行使用メモリ 24,192 KB
平均クエリ数 31.43
最終ジャッジ日時 2023-09-23 20:24:56
合計ジャッジ時間 3,321 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
23,904 KB
testcase_01 AC 37 ms
23,724 KB
testcase_02 AC 38 ms
23,724 KB
testcase_03 AC 37 ms
23,472 KB
testcase_04 AC 37 ms
24,132 KB
testcase_05 AC 38 ms
23,736 KB
testcase_06 AC 37 ms
23,280 KB
testcase_07 AC 37 ms
23,532 KB
testcase_08 AC 37 ms
23,436 KB
testcase_09 AC 38 ms
24,192 KB
testcase_10 AC 37 ms
23,304 KB
testcase_11 AC 36 ms
23,712 KB
testcase_12 AC 36 ms
23,304 KB
testcase_13 AC 36 ms
23,520 KB
testcase_14 AC 39 ms
23,556 KB
testcase_15 AC 38 ms
23,916 KB
testcase_16 AC 37 ms
23,460 KB
testcase_17 AC 35 ms
23,880 KB
testcase_18 AC 39 ms
23,556 KB
testcase_19 AC 37 ms
23,304 KB
testcase_20 AC 40 ms
23,736 KB
testcase_21 AC 39 ms
24,192 KB
testcase_22 AC 38 ms
24,168 KB
testcase_23 AC 39 ms
23,304 KB
testcase_24 AC 38 ms
23,544 KB
testcase_25 AC 39 ms
23,712 KB
testcase_26 AC 39 ms
23,328 KB
testcase_27 AC 38 ms
23,904 KB
testcase_28 AC 38 ms
23,892 KB
testcase_29 AC 40 ms
23,508 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <stdio.h>
#include <cstring>
#include <math.h>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define LL long long
#define mass 1000000007
using namespace std;

int main(){
	int y1=1000000000;
	int sa;
	int y=500000000;
	int res;
	rep(i,100){
		cout<<"? "<<y<<endl;
		cin>>res;
		sa=max(y1-y,y-y1)/2;
		if(sa<=1) break;
		y1=y;
		if(res){
			y=sa+y;
		}else{
			y=y-sa;
		}
	}
	//cout<<"この段階での "<<"res="<<res<<" y="<<y<<endl;
	//int t;
	//cin>>t;
	if(res){
		while(res){
			y++;
			cout<<"? "<<y<<endl;
			cin>>res;
		}
		y--;
	}else{
		while(res==0){
			y--;
			cout<<"? "<<y<<endl;
			cin>>res;
		}
	}
	cout<<"! "<<y<<endl;




	
	return 0;
	

}
	
0