結果

問題 No.1286 Stone Skipping
ユーザー brthyyjpbrthyyjp
提出日時 2022-01-30 15:32:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 77 ms / 2,000 ms
コード長 364 bytes
コンパイル時間 277 ms
コンパイル使用メモリ 87,304 KB
実行使用メモリ 76,804 KB
最終ジャッジ日時 2023-09-02 01:39:27
合計ジャッジ時間 4,450 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
76,456 KB
testcase_01 AC 73 ms
76,752 KB
testcase_02 AC 76 ms
76,768 KB
testcase_03 AC 75 ms
76,620 KB
testcase_04 AC 73 ms
76,524 KB
testcase_05 AC 73 ms
76,488 KB
testcase_06 AC 73 ms
76,420 KB
testcase_07 AC 74 ms
76,560 KB
testcase_08 AC 74 ms
76,684 KB
testcase_09 AC 75 ms
76,432 KB
testcase_10 AC 74 ms
76,608 KB
testcase_11 AC 74 ms
76,588 KB
testcase_12 AC 74 ms
76,308 KB
testcase_13 AC 74 ms
76,680 KB
testcase_14 AC 75 ms
76,632 KB
testcase_15 AC 74 ms
76,800 KB
testcase_16 AC 73 ms
76,776 KB
testcase_17 AC 76 ms
76,632 KB
testcase_18 AC 73 ms
76,584 KB
testcase_19 AC 72 ms
76,524 KB
testcase_20 AC 73 ms
76,336 KB
testcase_21 AC 71 ms
76,552 KB
testcase_22 AC 72 ms
76,576 KB
testcase_23 AC 74 ms
76,752 KB
testcase_24 AC 73 ms
76,804 KB
testcase_25 AC 71 ms
76,688 KB
testcase_26 AC 72 ms
76,752 KB
testcase_27 AC 77 ms
76,600 KB
testcase_28 AC 76 ms
76,600 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

d = int(input())

def f(x, k):
    res = 0
    for i in range(k):
        res += x
        x //= 2
    return res

ans = d
for k in range(1, 65):
    ok = 0
    ng = 10**18+1
    while ok+1 < ng:
        mid = (ok+ng)//2
        if f(mid, k) <= d:
            ok = mid
        else:
            ng = mid
    if f(ok, k) == d:
        ans = min(ans, ok)
print(ans)
0