結果

問題 No.253 ロウソクの長さ
ユーザー startcppstartcpp
提出日時 2015-07-25 00:16:25
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 632 bytes
コンパイル時間 601 ms
コンパイル使用メモリ 73,084 KB
実行使用メモリ 24,396 KB
平均クエリ数 30.03
最終ジャッジ日時 2023-09-23 05:03:43
合計ジャッジ時間 4,405 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
23,820 KB
testcase_01 AC 25 ms
23,964 KB
testcase_02 AC 25 ms
23,268 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 25 ms
23,532 KB
testcase_06 AC 25 ms
24,240 KB
testcase_07 AC 24 ms
24,192 KB
testcase_08 AC 25 ms
24,252 KB
testcase_09 WA -
testcase_10 AC 25 ms
24,276 KB
testcase_11 AC 25 ms
23,316 KB
testcase_12 AC 27 ms
23,976 KB
testcase_13 AC 25 ms
24,252 KB
testcase_14 WA -
testcase_15 AC 25 ms
23,556 KB
testcase_16 WA -
testcase_17 AC 25 ms
23,652 KB
testcase_18 AC 25 ms
23,460 KB
testcase_19 WA -
testcase_20 AC 25 ms
23,820 KB
testcase_21 AC 25 ms
24,300 KB
testcase_22 WA -
testcase_23 AC 24 ms
23,640 KB
testcase_24 AC 25 ms
23,952 KB
testcase_25 AC 25 ms
23,268 KB
testcase_26 AC 25 ms
23,448 KB
testcase_27 AC 25 ms
23,292 KB
testcase_28 AC 24 ms
23,616 KB
testcase_29 AC 24 ms
24,264 KB
testcase_30 AC 23 ms
23,844 KB
testcase_31 AC 24 ms
23,268 KB
testcase_32 AC 24 ms
23,940 KB
testcase_33 AC 24 ms
23,280 KB
testcase_34 WA -
testcase_35 AC 24 ms
23,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<functional>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;

int ask(int Y){
	cout << "? " << Y << endl;
	int res;
	cin >> res;
	return res;
}

signed main() {
	int st = 10, ed = 1000000000, medi;
	int counter = 0;
	
	while (st <= ed) {
		medi = (st + ed) / 2;
		int res = ask(medi - counter);
		if (res == 0)
			break;
		if (res == -1)
			ed = medi - 1;
		if (res == 1)
			st = medi + 1;
		counter++;
	}
	cout << "! " << medi << endl;
	return 0;
}
0