結果

問題 No.246 質問と回答
ユーザー airisairis
提出日時 2015-07-20 20:28:17
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 55 ms / 2,000 ms
コード長 908 bytes
コンパイル時間 881 ms
コンパイル使用メモリ 80,424 KB
実行使用メモリ 25,220 KB
平均クエリ数 30.90
最終ジャッジ日時 2024-07-16 19:49:38
合計ジャッジ時間 4,037 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <numeric>
#include <bitset>
#include <complex>
#define rep(x, to) for (int x = 0; x < (to); x++)
#define REP(x, a, to) for (int x = (a); x < (to); x++)
#define foreach(itr, x) for (typeof((x).begin()) itr = (x).begin(); itr != (x).end(); itr++)
#define EPS (1e-14)

using namespace std;

typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef complex<double> Complex;
typedef vector< vector<int> > Mat;


int main() {
	int mn = 1;
	int mx = 1e+9 + 7;
	while (mx - mn > 1) {
		int mid = (mn + mx) / 2;
		cout << "? " << mid << endl;
		int x;
		cin >> x;
		if (x > 0) {
			mn = mid;
		} else {
			mx = mid;
		}
	}
	cout << "! " << mn << endl;
	return 0;
}


0