結果

問題 No.253 ロウソクの長さ
ユーザー TawaraTawara
提出日時 2015-08-01 18:45:51
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 406 bytes
コンパイル時間 154 ms
コンパイル使用メモリ 6,536 KB
実行使用メモリ 24,516 KB
平均クエリ数 37.03
最終ジャッジ日時 2023-09-23 05:36:46
合計ジャッジ時間 6,366 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 38 ms
23,652 KB
testcase_02 AC 40 ms
23,580 KB
testcase_03 AC 42 ms
23,448 KB
testcase_04 AC 36 ms
24,048 KB
testcase_05 AC 37 ms
24,264 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 37 ms
24,276 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 37 ms
24,072 KB
testcase_15 AC 41 ms
23,412 KB
testcase_16 AC 38 ms
23,412 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 36 ms
23,412 KB
testcase_20 WA -
testcase_21 AC 39 ms
23,424 KB
testcase_22 AC 39 ms
23,964 KB
testcase_23 WA -
testcase_24 AC 38 ms
23,868 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 39 ms
23,664 KB
testcase_35 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

def ans(Y):
	print "! %d" % Y

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