結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
23,592 KB
testcase_01 AC 26 ms
24,360 KB
testcase_02 AC 26 ms
24,060 KB
testcase_03 AC 26 ms
23,340 KB
testcase_04 AC 26 ms
23,964 KB
testcase_05 WA -
testcase_06 AC 27 ms
24,240 KB
testcase_07 AC 27 ms
23,388 KB
testcase_08 AC 28 ms
23,376 KB
testcase_09 AC 26 ms
23,424 KB
testcase_10 AC 27 ms
23,412 KB
testcase_11 AC 27 ms
24,036 KB
testcase_12 AC 27 ms
23,628 KB
testcase_13 AC 27 ms
24,048 KB
testcase_14 AC 26 ms
23,628 KB
testcase_15 AC 27 ms
23,520 KB
testcase_16 AC 25 ms
24,396 KB
testcase_17 AC 27 ms
23,604 KB
testcase_18 AC 26 ms
23,820 KB
testcase_19 AC 25 ms
23,652 KB
testcase_20 AC 27 ms
23,520 KB
testcase_21 WA -
testcase_22 AC 25 ms
24,036 KB
testcase_23 AC 26 ms
23,820 KB
testcase_24 AC 25 ms
23,580 KB
testcase_25 AC 26 ms
23,820 KB
testcase_26 AC 26 ms
24,000 KB
testcase_27 AC 26 ms
23,364 KB
testcase_28 AC 26 ms
24,024 KB
testcase_29 AC 26 ms
23,592 KB
testcase_30 AC 26 ms
24,360 KB
testcase_31 AC 26 ms
23,568 KB
testcase_32 AC 25 ms
23,448 KB
testcase_33 AC 25 ms
23,448 KB
testcase_34 AC 26 ms
23,676 KB
testcase_35 AC 27 ms
24,000 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 << 30), 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;
		}
		
		ask += ans1 * (1 << (29 - i));
		printf("? %d\n", ask - (2 * i + 1) ); fflush(stdout);
		scanf("%d", &ans1);
		if(ans1 == 0) {
			y = ask;
			break;
		}
	}
	printf("! %d\n", y); fflush(stdout);
	return 0;
}
0