結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,352 KB
testcase_01 AC 73 ms
71,144 KB
testcase_02 AC 83 ms
75,628 KB
testcase_03 AC 81 ms
75,624 KB
testcase_04 AC 84 ms
75,736 KB
testcase_05 AC 82 ms
75,420 KB
testcase_06 AC 83 ms
75,824 KB
testcase_07 AC 80 ms
75,420 KB
testcase_08 AC 81 ms
75,764 KB
testcase_09 WA -
testcase_10 AC 82 ms
75,420 KB
testcase_11 WA -
testcase_12 AC 83 ms
75,716 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 88 ms
75,696 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 RE -
testcase_19 AC 72 ms
71,260 KB
testcase_20 AC 82 ms
75,680 KB
testcase_21 AC 81 ms
75,872 KB
testcase_22 AC 83 ms
75,820 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 87 ms
75,916 KB
testcase_26 AC 85 ms
75,920 KB
testcase_27 WA -
testcase_28 AC 83 ms
75,876 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
    while x>0:
        v += x
        x //= 2
        i += 1
        if i>=k:
            break
    return v>=d
def val(x, k):
    v = 0
    i = 0
    while x>0:
        v += x
        x //= 2
        i += 1
        if i>=k:
            break
    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(m,k)==d:
        return m
    else:
        return None
for v in range(2,100):
    tmp = proc(v)
    if tmp is not None:
        ans = min(ans, tmp)
print(ans)
0