結果

問題 No.253 ロウソクの長さ
ユーザー TawaraTawara
提出日時 2015-08-01 18:19:04
言語 Python2
(2.7.18)
結果
AC  
実行時間 42 ms / 2,000 ms
コード長 477 bytes
コンパイル時間 58 ms
コンパイル使用メモリ 6,564 KB
実行使用メモリ 24,384 KB
平均クエリ数 34.28
最終ジャッジ日時 2023-09-23 21:18:39
合計ジャッジ時間 3,364 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
23,520 KB
testcase_01 AC 37 ms
23,580 KB
testcase_02 AC 36 ms
23,568 KB
testcase_03 AC 34 ms
23,904 KB
testcase_04 AC 33 ms
23,904 KB
testcase_05 AC 35 ms
24,132 KB
testcase_06 AC 34 ms
23,424 KB
testcase_07 AC 34 ms
24,180 KB
testcase_08 AC 34 ms
23,904 KB
testcase_09 AC 34 ms
23,640 KB
testcase_10 AC 35 ms
24,024 KB
testcase_11 AC 34 ms
23,376 KB
testcase_12 AC 34 ms
24,132 KB
testcase_13 AC 34 ms
23,664 KB
testcase_14 AC 36 ms
23,412 KB
testcase_15 AC 36 ms
23,772 KB
testcase_16 AC 34 ms
23,772 KB
testcase_17 AC 32 ms
23,784 KB
testcase_18 AC 33 ms
23,688 KB
testcase_19 AC 34 ms
24,192 KB
testcase_20 AC 34 ms
23,676 KB
testcase_21 AC 33 ms
23,868 KB
testcase_22 AC 33 ms
23,592 KB
testcase_23 AC 33 ms
23,364 KB
testcase_24 AC 35 ms
24,204 KB
testcase_25 AC 33 ms
24,240 KB
testcase_26 AC 34 ms
24,192 KB
testcase_27 AC 35 ms
23,688 KB
testcase_28 AC 36 ms
24,192 KB
testcase_29 AC 34 ms
23,352 KB
testcase_30 AC 33 ms
23,676 KB
testcase_31 AC 34 ms
23,592 KB
testcase_32 AC 34 ms
24,384 KB
testcase_33 AC 33 ms
23,388 KB
testcase_34 AC 32 ms
23,868 KB
testcase_35 AC 33 ms
23,772 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
def ask(Y):
	print "? %d" % Y
	sys.stdout.flush()
	res = int(raw_input())
	return res

res = ask(100)
if res == 0:
	print "! %d" % 100
elif res == -1:
	for i in range(99):
		if ask(0) == 0:
			print "! %d" % (i+1)
			break
else:
	left = 100
	right = 10**9 + 1
	for i in range(99):
		mid = (left + right) / 2
		res = ask(mid)
		if res == 0:
			print "! %d" % (i+1+mid)
			break
		elif res == -1:
			left -= 1
			right = mid - 1
		else:
			left = mid - 1
			right -= 1
0