結果

問題 No.1286 Stone Skipping
ユーザー shotoyooshotoyoo
提出日時 2020-11-13 21:26:40
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 551 bytes
コンパイル時間 364 ms
コンパイル使用メモリ 87,144 KB
実行使用メモリ 75,768 KB
最終ジャッジ日時 2023-09-30 02:33:15
合計ジャッジ時間 3,661 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,416 KB
testcase_01 AC 74 ms
71,604 KB
testcase_02 AC 81 ms
75,388 KB
testcase_03 AC 74 ms
71,432 KB
testcase_04 AC 73 ms
71,248 KB
testcase_05 WA -
testcase_06 AC 73 ms
71,388 KB
testcase_07 AC 72 ms
71,272 KB
testcase_08 AC 74 ms
71,144 KB
testcase_09 AC 73 ms
71,444 KB
testcase_10 AC 75 ms
71,516 KB
testcase_11 AC 74 ms
71,164 KB
testcase_12 AC 73 ms
71,236 KB
testcase_13 AC 77 ms
75,196 KB
testcase_14 AC 76 ms
75,144 KB
testcase_15 WA -
testcase_16 AC 76 ms
75,040 KB
testcase_17 AC 75 ms
75,216 KB
testcase_18 AC 71 ms
71,488 KB
testcase_19 AC 72 ms
71,512 KB
testcase_20 AC 75 ms
75,284 KB
testcase_21 AC 76 ms
75,300 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 75 ms
75,476 KB
testcase_26 AC 75 ms
75,172 KB
testcase_27 AC 75 ms
75,332 KB
testcase_28 WA -
権限があれば一括ダウンロードができます

ソースコード

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())
def sub(x):
    v = x
    while x>0:
        x = x//2
        v += x
    return v>=d
def val(x):
    v = x
    while x>0:
        x = x//2
        v += x
        if v==d:
            return v
    return v
l = 0
r = d
while l<r-1:
    m = (l+r)//2
    if sub(m):
        r = m
    else:
        l = m
# print(r, val(r))
while val(r)>d:
    r -= 1
if val(r)==d:
    print(r)
else:
    print(d)
0