結果

問題 No.246 質問と回答
ユーザー IL_mstaIL_msta
提出日時 2015-07-18 00:18:11
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 38 ms / 2,000 ms
コード長 1,075 bytes
コンパイル時間 1,055 ms
コンパイル使用メモリ 83,804 KB
実行使用メモリ 24,420 KB
平均クエリ数 30.90
最終ジャッジ日時 2023-09-23 19:59:33
合計ジャッジ時間 3,197 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
24,204 KB
testcase_01 AC 34 ms
24,264 KB
testcase_02 AC 35 ms
23,352 KB
testcase_03 AC 34 ms
23,784 KB
testcase_04 AC 33 ms
23,616 KB
testcase_05 AC 34 ms
23,964 KB
testcase_06 AC 33 ms
23,784 KB
testcase_07 AC 34 ms
24,312 KB
testcase_08 AC 34 ms
23,568 KB
testcase_09 AC 34 ms
23,388 KB
testcase_10 AC 34 ms
24,048 KB
testcase_11 AC 34 ms
23,904 KB
testcase_12 AC 36 ms
23,892 KB
testcase_13 AC 35 ms
24,156 KB
testcase_14 AC 36 ms
23,952 KB
testcase_15 AC 34 ms
23,580 KB
testcase_16 AC 34 ms
23,580 KB
testcase_17 AC 35 ms
24,192 KB
testcase_18 AC 34 ms
23,784 KB
testcase_19 AC 34 ms
23,496 KB
testcase_20 AC 33 ms
23,328 KB
testcase_21 AC 34 ms
23,928 KB
testcase_22 AC 33 ms
23,904 KB
testcase_23 AC 34 ms
23,928 KB
testcase_24 AC 37 ms
23,928 KB
testcase_25 AC 36 ms
23,772 KB
testcase_26 AC 38 ms
23,580 KB
testcase_27 AC 37 ms
23,952 KB
testcase_28 AC 36 ms
23,364 KB
testcase_29 AC 35 ms
24,420 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
 
#include <iostream>
#include <iomanip>
 
#include <algorithm>
#include <cmath>
 
#include <string>
//#include <array>
#include <list>
#include <queue>
#include <vector>
#include <complex>
#include <set>
#include <map>
 
/////////
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define P(p) cout<<(p)<<endl;
 
#define PII pair<int,int>
/////////
typedef long long LL;
typedef long double LD;
/////////
using namespace::std;
/////////

int main(void){
    std::cin.tie(0); 
    std::ios::sync_with_stdio(false);
    std::cout << std::fixed;//
    //cout << setprecision(10);//
	
	//1->10^9
	int Left = 1;
	int Right = (int)1e9;
	int mid;
	int res;
	while( Left < Right ){
		mid = (Right+Left)/2;
		cout<< "? "<<mid<<endl;
		cin>>res;
		if(res==1){
			Left = mid;
		}else{
			Right = mid-1;
		}
		if(Right-Left == 1){
			cout<<"? "<<Right<<endl;
			cin>>res;
			if(res==1){
				cout<<"! "<<Right<<endl;
				return 0;
			}else{
				cout<<"! "<<Left<<endl;
				return 0;
			}
		}
	}
	cout<<"! "<<Left<<endl;
    return 0;
}
0