結果

問題 No.1286 Stone Skipping
ユーザー roarisroaris
提出日時 2020-11-14 00:57:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 82 ms / 2,000 ms
コード長 369 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 86,916 KB
実行使用メモリ 76,480 KB
最終ジャッジ日時 2023-09-30 16:10:16
合計ジャッジ時間 3,729 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
75,100 KB
testcase_01 AC 75 ms
75,156 KB
testcase_02 AC 79 ms
76,268 KB
testcase_03 AC 77 ms
75,316 KB
testcase_04 AC 78 ms
75,436 KB
testcase_05 AC 76 ms
75,440 KB
testcase_06 AC 76 ms
75,224 KB
testcase_07 AC 77 ms
75,444 KB
testcase_08 AC 80 ms
76,128 KB
testcase_09 AC 79 ms
76,112 KB
testcase_10 AC 79 ms
76,196 KB
testcase_11 AC 80 ms
76,328 KB
testcase_12 AC 81 ms
76,220 KB
testcase_13 AC 82 ms
76,432 KB
testcase_14 AC 80 ms
76,316 KB
testcase_15 AC 81 ms
76,396 KB
testcase_16 AC 80 ms
76,388 KB
testcase_17 AC 81 ms
76,240 KB
testcase_18 AC 76 ms
75,116 KB
testcase_19 AC 76 ms
75,020 KB
testcase_20 AC 79 ms
76,480 KB
testcase_21 AC 79 ms
76,324 KB
testcase_22 AC 80 ms
76,108 KB
testcase_23 AC 80 ms
76,168 KB
testcase_24 AC 80 ms
76,132 KB
testcase_25 AC 81 ms
76,252 KB
testcase_26 AC 79 ms
76,308 KB
testcase_27 AC 80 ms
76,212 KB
testcase_28 AC 81 ms
76,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def f(x, c):
    res = 0
    
    for _ in range(c):
        res += x
        x //= 2
    
    return res
    
D = int(input())
ans = D

for i in range(1, 60):
    l, r = 1, D
    
    while l<=r:
        m = (l+r)//2
        
        if f(m, i)>=D:
            r = m-1
        else:
            l = m+1
    
    if f(l, i)==D:
        ans = min(ans, l)
    
print(ans)
0