結果

問題 No.1286 Stone Skipping
ユーザー 👑 tamatotamato
提出日時 2020-11-13 21:38:58
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 604 bytes
コンパイル時間 400 ms
コンパイル使用メモリ 87,708 KB
実行使用メモリ 80,820 KB
最終ジャッジ日時 2023-09-30 02:38:54
合計ジャッジ時間 8,625 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,880 KB
testcase_01 AC 76 ms
71,240 KB
testcase_02 AC 79 ms
75,768 KB
testcase_03 AC 75 ms
71,684 KB
testcase_04 AC 75 ms
71,836 KB
testcase_05 AC 73 ms
71,652 KB
testcase_06 AC 75 ms
71,656 KB
testcase_07 AC 75 ms
71,688 KB
testcase_08 AC 75 ms
71,252 KB
testcase_09 AC 75 ms
71,300 KB
testcase_10 AC 74 ms
71,252 KB
testcase_11 AC 75 ms
71,680 KB
testcase_12 AC 73 ms
71,512 KB
testcase_13 AC 77 ms
75,500 KB
testcase_14 AC 78 ms
75,544 KB
testcase_15 AC 79 ms
75,808 KB
testcase_16 AC 78 ms
75,484 KB
testcase_17 AC 78 ms
75,548 KB
testcase_18 AC 74 ms
71,668 KB
testcase_19 AC 74 ms
71,456 KB
testcase_20 AC 79 ms
75,808 KB
testcase_21 AC 78 ms
75,444 KB
testcase_22 AC 79 ms
75,832 KB
testcase_23 TLE -
testcase_24 TLE -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    D = int(input())
    ok = D
    ng = 0
    mid = (ok+ng)//2
    while ok - ng > 1:
        tmp = 0
        x = mid
        while x:
            tmp += x
            x //= 2
        if tmp >= D:
            ok = mid
        else:
            ng = mid
        mid = (ok+ng)//2

    for xx in range(ok, D+1):
        tmp = 0
        x = xx
        while x:
            tmp += x
            x //= 2
            if tmp == D:
                print(xx)
                exit()


if __name__ == '__main__':
    main()
0