結果
問題 |
No.253 ロウソクの長さ
|
ユーザー |
![]() |
提出日時 | 2021-02-12 15:30:25 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 794 bytes |
コンパイル時間 | 291 ms |
コンパイル使用メモリ | 82,204 KB |
実行使用メモリ | 70,932 KB |
平均クエリ数 | 35.08 |
最終ジャッジ日時 | 2024-07-17 10:30:50 |
合計ジャッジ時間 | 7,793 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 14 WA * 22 |
ソースコード
# coding:UTF-8 import sys MOD = 10 ** 9 + 7 INF = float('inf') # 二分探索 imin = 0 imax = 10 ** 9 + 1 print("? {}".format(99)) check = int(input()) if check == 0: print("! {}".format(99)) elif check == -1: time = 1 while True: print("? {}".format(0)) check = int(input()) if check == 0: break time += 1 print("! {}".format(time)) elif check == 1: time = 0 while True: imid = imin + (imax - imin) // 2 print("? {}".format(imid - time)) check = int(input()) # 2分探索する。 if check == 0: res = imid break elif check == 1: imin = imid else: imax = imid time += 1 print("! {}".format(res))