結果

問題 No.253 ロウソクの長さ
ユーザー 𖧱𖦸𖥩𖥣𖥩𖥣
提出日時 2024-06-12 13:14:33
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 57 ms / 2,000 ms
コード長 473 bytes
コンパイル時間 403 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 27,480 KB
平均クエリ数 30.64
最終ジャッジ日時 2024-06-12 13:14:38
合計ジャッジ時間 4,750 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

print("? 100", flush=True)
c = int(input())
t = 1
if c == 0:
	print("! 100")
elif c < 0:
	while True:
		print("? 9", flush=True)
		c = int(input())
		if c == 0:
			print("!", t+9)
			break
		t += 1
else:
	left = 100
	right = 10**9-1
	while True:
		center = (left + right + 1)//2
		print("?", center, flush="True")
		c = int(input())
		if c == 0:
			print("!", center+t)
			break
		elif c > 0:
			left = center
			right -= 1
		else:
			right = center-2
			left -= 1
		t += 1
0