結果

問題 No.1286 Stone Skipping
ユーザー shotoyooshotoyoo
提出日時 2020-11-13 21:42:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 89 ms / 2,000 ms
コード長 704 bytes
コンパイル時間 327 ms
コンパイル使用メモリ 86,904 KB
実行使用メモリ 76,584 KB
最終ジャッジ日時 2023-09-30 16:05:03
合計ジャッジ時間 4,040 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
75,444 KB
testcase_01 AC 77 ms
75,572 KB
testcase_02 AC 89 ms
76,248 KB
testcase_03 AC 81 ms
76,372 KB
testcase_04 AC 80 ms
76,424 KB
testcase_05 AC 80 ms
76,416 KB
testcase_06 AC 81 ms
76,404 KB
testcase_07 AC 81 ms
76,332 KB
testcase_08 AC 81 ms
76,528 KB
testcase_09 AC 82 ms
76,360 KB
testcase_10 AC 83 ms
76,376 KB
testcase_11 AC 81 ms
76,420 KB
testcase_12 AC 81 ms
76,404 KB
testcase_13 AC 82 ms
76,436 KB
testcase_14 AC 83 ms
76,384 KB
testcase_15 AC 84 ms
76,240 KB
testcase_16 AC 82 ms
76,244 KB
testcase_17 AC 81 ms
76,368 KB
testcase_18 AC 75 ms
75,476 KB
testcase_19 AC 77 ms
75,248 KB
testcase_20 AC 81 ms
76,532 KB
testcase_21 AC 81 ms
76,464 KB
testcase_22 AC 79 ms
76,436 KB
testcase_23 AC 80 ms
76,512 KB
testcase_24 AC 82 ms
76,192 KB
testcase_25 AC 82 ms
76,420 KB
testcase_26 AC 81 ms
76,584 KB
testcase_27 AC 82 ms
76,512 KB
testcase_28 AC 82 ms
76,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


d = int(input())
ans = d
def sub(x, k):
    v = 0
    i = 0
    for i in range(k):
        v += x
        x //= 2
    return v>=d
def val(x, k):
    v = 0
    i = 0
    for i in range(k):
        v += x
        x //= 2
    return v
def proc(k):
    l = 0
    r = d
    while l<r-1:
        m = (l+r)//2
        if sub(m,k):
            r = m
        else:
            l = m
    if val(r,k)==d:
        return r
    else:
        return None
for v in range(1,100):
    tmp = proc(v)
#     print(tmp)
    if tmp is not None:
        ans = min(ans, tmp)
print(ans)
0