結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 36 ms
23,820 KB
testcase_02 AC 39 ms
23,388 KB
testcase_03 AC 36 ms
24,228 KB
testcase_04 AC 40 ms
23,448 KB
testcase_05 AC 37 ms
23,424 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 35 ms
24,024 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 36 ms
23,364 KB
testcase_15 AC 40 ms
24,252 KB
testcase_16 AC 37 ms
23,976 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 35 ms
24,336 KB
testcase_20 WA -
testcase_21 AC 38 ms
24,000 KB
testcase_22 AC 36 ms
23,952 KB
testcase_23 WA -
testcase_24 AC 39 ms
23,664 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 37 ms
23,424 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