結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
23,860 KB
testcase_01 AC 33 ms
23,868 KB
testcase_02 AC 36 ms
23,424 KB
testcase_03 AC 34 ms
24,180 KB
testcase_04 AC 33 ms
23,712 KB
testcase_05 AC 34 ms
24,132 KB
testcase_06 AC 32 ms
23,592 KB
testcase_07 AC 33 ms
24,216 KB
testcase_08 AC 34 ms
23,904 KB
testcase_09 AC 33 ms
23,856 KB
testcase_10 AC 35 ms
23,772 KB
testcase_11 AC 33 ms
24,240 KB
testcase_12 AC 33 ms
24,084 KB
testcase_13 AC 34 ms
23,676 KB
testcase_14 AC 34 ms
24,048 KB
testcase_15 AC 36 ms
23,352 KB
testcase_16 AC 33 ms
23,508 KB
testcase_17 AC 32 ms
24,036 KB
testcase_18 AC 35 ms
23,772 KB
testcase_19 AC 33 ms
23,388 KB
testcase_20 AC 34 ms
23,460 KB
testcase_21 AC 34 ms
24,024 KB
testcase_22 AC 33 ms
23,460 KB
testcase_23 AC 33 ms
24,312 KB
testcase_24 AC 35 ms
24,264 KB
testcase_25 AC 34 ms
23,424 KB
testcase_26 AC 33 ms
24,024 KB
testcase_27 AC 33 ms
23,616 KB
testcase_28 AC 33 ms
24,360 KB
testcase_29 AC 35 ms
24,132 KB
testcase_30 AC 33 ms
24,216 KB
testcase_31 AC 33 ms
23,592 KB
testcase_32 AC 34 ms
23,652 KB
testcase_33 AC 33 ms
23,640 KB
testcase_34 AC 33 ms
24,360 KB
testcase_35 AC 33 ms
24,024 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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