結果
| 問題 | No.253 ロウソクの長さ |
| コンテスト | |
| ユーザー |
𖧱𖦸𖥩𖥣𖥩𖥣
|
| 提出日時 | 2024-06-12 13:15:05 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 61 ms / 2,000 ms |
| コード長 | 473 bytes |
| 記録 | |
| コンパイル時間 | 374 ms |
| コンパイル使用メモリ | 82,136 KB |
| 実行使用メモリ | 70,564 KB |
| 平均クエリ数 | 30.64 |
| 最終ジャッジ日時 | 2024-06-12 13:15:10 |
| 合計ジャッジ時間 | 4,733 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 36 |
ソースコード
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
𖧱𖦸𖥩𖥣𖥩𖥣