結果
問題 | No.1286 Stone Skipping |
ユーザー | None |
提出日時 | 2021-05-01 07:17:11 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 76 ms / 2,000 ms |
コード長 | 687 bytes |
コンパイル時間 | 212 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 76,160 KB |
最終ジャッジ日時 | 2024-07-19 09:16:47 |
合計ジャッジ時間 | 3,447 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 |
ソースコード
def binary_search_int(ok, ng, test): """ :param ok: solve(x) = True を必ず満たす点 :param ng: solve(x) = False を必ず満たす点 """ while abs(ok - ng) > 1: mid = (ok + ng) // 2 if test(mid): ok = mid else: ng = mid return ok def f(x): _res=0 for _ in range(k): _res+=x x//=2 return _res ############################################################## import sys input = sys.stdin.readline def test(x): return f(x)<=D D=int(input()) res=float("inf") for k in range(1,60): tmp=binary_search_int(0,10**19,test) if f(tmp)==D: res=min(tmp,res) print(res)