結果

問題 No.1286 Stone Skipping
ユーザー shotoyooshotoyoo
提出日時 2020-11-13 21:42:13
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 704 bytes
コンパイル時間 479 ms
コンパイル使用メモリ 86,688 KB
実行使用メモリ 78,772 KB
最終ジャッジ日時 2023-09-30 02:39:51
合計ジャッジ時間 4,115 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
75,440 KB
testcase_01 WA -
testcase_02 AC 79 ms
76,164 KB
testcase_03 AC 78 ms
76,176 KB
testcase_04 AC 80 ms
75,948 KB
testcase_05 AC 79 ms
76,212 KB
testcase_06 AC 79 ms
76,500 KB
testcase_07 AC 78 ms
76,440 KB
testcase_08 AC 79 ms
76,168 KB
testcase_09 WA -
testcase_10 AC 78 ms
76,164 KB
testcase_11 WA -
testcase_12 AC 79 ms
76,436 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 79 ms
76,172 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 RE -
testcase_19 WA -
testcase_20 AC 80 ms
76,424 KB
testcase_21 AC 81 ms
76,212 KB
testcase_22 AC 79 ms
76,352 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 80 ms
76,324 KB
testcase_26 AC 80 ms
76,172 KB
testcase_27 WA -
testcase_28 AC 82 ms
76,292 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 m
    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