結果

問題 No.253 ロウソクの長さ
ユーザー masamasa
提出日時 2016-07-13 22:29:02
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 25 ms / 2,000 ms
コード長 523 bytes
コンパイル時間 490 ms
コンパイル使用メモリ 65,224 KB
実行使用メモリ 24,396 KB
平均クエリ数 24.81
最終ジャッジ日時 2023-09-24 00:11:14
合計ジャッジ時間 2,967 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
23,604 KB
testcase_01 AC 21 ms
23,508 KB
testcase_02 AC 24 ms
23,352 KB
testcase_03 AC 20 ms
24,348 KB
testcase_04 AC 20 ms
23,856 KB
testcase_05 AC 19 ms
23,640 KB
testcase_06 AC 21 ms
24,348 KB
testcase_07 AC 20 ms
24,000 KB
testcase_08 AC 24 ms
24,072 KB
testcase_09 AC 20 ms
23,340 KB
testcase_10 AC 21 ms
24,060 KB
testcase_11 AC 21 ms
23,664 KB
testcase_12 AC 20 ms
23,664 KB
testcase_13 AC 21 ms
23,508 KB
testcase_14 AC 19 ms
23,364 KB
testcase_15 AC 20 ms
24,348 KB
testcase_16 AC 18 ms
23,604 KB
testcase_17 AC 21 ms
23,832 KB
testcase_18 AC 21 ms
23,988 KB
testcase_19 AC 19 ms
23,832 KB
testcase_20 AC 19 ms
24,072 KB
testcase_21 AC 19 ms
24,228 KB
testcase_22 AC 19 ms
23,508 KB
testcase_23 AC 20 ms
23,508 KB
testcase_24 AC 21 ms
23,352 KB
testcase_25 AC 20 ms
23,412 KB
testcase_26 AC 20 ms
23,352 KB
testcase_27 AC 19 ms
24,384 KB
testcase_28 AC 20 ms
24,036 KB
testcase_29 AC 20 ms
24,036 KB
testcase_30 AC 20 ms
23,988 KB
testcase_31 AC 20 ms
24,024 KB
testcase_32 AC 20 ms
24,000 KB
testcase_33 AC 19 ms
24,396 KB
testcase_34 AC 20 ms
23,436 KB
testcase_35 AC 23 ms
23,556 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>

using namespace std;

int main() {

	int minus = 0;
	int ret;
	cout << "? 64" << endl;
	cin >> ret;
	minus++;

	if (ret == 0) {
		cout << "? 64" << endl;
		return 0;
	}

	int n_bit = ret == 1 ? 31 : 6;
	int ans = 1 << n_bit;
	ans--;
	for (int i = n_bit - 1; i >= 0; i--) {
		int tmp = ans - (1 << i);
		cout << "? " << tmp - minus << endl;
		cin >> ret;
		minus++;
		if (ret == 0) {
			ans = tmp;
			break;
		} else if (ret < 0) {
			ans = tmp;
		}
	}
	cout << "! " << ans << endl;
}
0