結果

問題 No.1286 Stone Skipping
ユーザー komkompikomkompi
提出日時 2023-11-04 11:48:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 72 ms / 2,000 ms
コード長 541 bytes
コンパイル時間 229 ms
コンパイル使用メモリ 81,880 KB
実行使用メモリ 64,244 KB
最終ジャッジ日時 2023-11-04 11:48:45
合計ジャッジ時間 2,691 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
59,232 KB
testcase_01 AC 40 ms
59,232 KB
testcase_02 AC 44 ms
62,196 KB
testcase_03 AC 41 ms
59,240 KB
testcase_04 AC 41 ms
59,240 KB
testcase_05 AC 41 ms
59,240 KB
testcase_06 AC 41 ms
59,240 KB
testcase_07 AC 42 ms
59,240 KB
testcase_08 AC 44 ms
62,196 KB
testcase_09 AC 44 ms
62,196 KB
testcase_10 AC 44 ms
62,196 KB
testcase_11 AC 44 ms
62,196 KB
testcase_12 AC 45 ms
62,196 KB
testcase_13 AC 46 ms
62,196 KB
testcase_14 AC 45 ms
62,196 KB
testcase_15 AC 46 ms
64,244 KB
testcase_16 AC 72 ms
62,196 KB
testcase_17 AC 46 ms
62,196 KB
testcase_18 AC 38 ms
57,184 KB
testcase_19 AC 39 ms
57,184 KB
testcase_20 AC 45 ms
64,244 KB
testcase_21 AC 45 ms
64,244 KB
testcase_22 AC 44 ms
62,196 KB
testcase_23 AC 45 ms
62,324 KB
testcase_24 AC 44 ms
62,196 KB
testcase_25 AC 45 ms
62,196 KB
testcase_26 AC 45 ms
62,196 KB
testcase_27 AC 45 ms
62,196 KB
testcase_28 AC 44 ms
62,196 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
# Your code here!

D=int(input())

MAX_BOUND=64

def calc_distance(init_power,k):
    rev=0
    for _ in range(k):
        rev+=init_power
        init_power//=2
        
    return rev

ans=10**27
for k in range(MAX_BOUND):
    high=D+1
    low=-1
    
    while high-low>1:
        middle=(high+low)//2
        
        distance=calc_distance(middle,k)
        
        if distance>=D:
            high=middle
        else:
            low=middle
    
    if calc_distance(high,k)==D:
        ans=min(ans,high)

print(ans)
0