結果

問題 No.253 ロウソクの長さ
ユーザー FF256grhyFF256grhy
提出日時 2015-07-25 02:58:23
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 442 bytes
コンパイル時間 144 ms
コンパイル使用メモリ 25,520 KB
実行使用メモリ 24,312 KB
平均クエリ数 49.64
最終ジャッジ日時 2023-09-23 05:13:01
合計ジャッジ時間 3,482 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
24,156 KB
testcase_01 AC 27 ms
24,156 KB
testcase_02 AC 28 ms
23,316 KB
testcase_03 AC 27 ms
23,424 KB
testcase_04 AC 27 ms
23,532 KB
testcase_05 WA -
testcase_06 AC 27 ms
23,280 KB
testcase_07 AC 27 ms
23,304 KB
testcase_08 AC 28 ms
24,144 KB
testcase_09 AC 26 ms
23,280 KB
testcase_10 AC 29 ms
23,268 KB
testcase_11 AC 28 ms
24,156 KB
testcase_12 AC 27 ms
23,724 KB
testcase_13 AC 28 ms
23,928 KB
testcase_14 AC 27 ms
23,832 KB
testcase_15 AC 28 ms
23,820 KB
testcase_16 AC 27 ms
23,532 KB
testcase_17 AC 29 ms
23,448 KB
testcase_18 AC 29 ms
23,316 KB
testcase_19 AC 28 ms
24,060 KB
testcase_20 AC 28 ms
23,280 KB
testcase_21 WA -
testcase_22 AC 28 ms
23,928 KB
testcase_23 AC 28 ms
23,556 KB
testcase_24 AC 29 ms
23,556 KB
testcase_25 AC 29 ms
23,292 KB
testcase_26 AC 29 ms
23,964 KB
testcase_27 AC 29 ms
23,316 KB
testcase_28 AC 29 ms
23,508 KB
testcase_29 AC 28 ms
23,424 KB
testcase_30 AC 29 ms
24,168 KB
testcase_31 AC 28 ms
23,568 KB
testcase_32 AC 27 ms
23,424 KB
testcase_33 AC 27 ms
23,304 KB
testcase_34 AC 26 ms
23,412 KB
testcase_35 AC 28 ms
24,312 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:21:8: warning: ‘y’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  printf("! %d\n", y); fflush(stdout);
  ~~~~~~^~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(void) {
	int i, ask = (1 << 29), ans0, ans1 = -1, y;
	for(i = 0; i < 30; i++) {
		printf("? %d\n", 1); fflush(stdout);
		scanf("%d", &ans0);
		if(ans0 != 1) {
			y = 2 * i + (ans0 == 0);
			break;
		}
		
		printf("? %d\n", ask - (2 * i + 1) ); fflush(stdout);
		scanf("%d", &ans1);
		ask += ans1 * (1 << (28 - i));
		if(ans1 == 0) {
			y = ask;
			break;
		}
	}
	printf("! %d\n", y); fflush(stdout);
	return 0;
}
0