結果

問題 No.1286 Stone Skipping
ユーザー maninimanini
提出日時 2021-01-25 18:52:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 87 ms / 2,000 ms
コード長 644 bytes
コンパイル時間 1,687 ms
コンパイル使用メモリ 86,448 KB
実行使用メモリ 76,580 KB
最終ジャッジ日時 2023-09-04 14:25:21
合計ジャッジ時間 4,777 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
75,512 KB
testcase_01 AC 82 ms
75,772 KB
testcase_02 AC 83 ms
76,444 KB
testcase_03 AC 83 ms
76,148 KB
testcase_04 AC 82 ms
76,512 KB
testcase_05 AC 82 ms
76,420 KB
testcase_06 AC 81 ms
76,464 KB
testcase_07 AC 83 ms
76,408 KB
testcase_08 AC 82 ms
76,148 KB
testcase_09 AC 84 ms
76,424 KB
testcase_10 AC 83 ms
76,404 KB
testcase_11 AC 84 ms
76,220 KB
testcase_12 AC 83 ms
76,580 KB
testcase_13 AC 86 ms
76,428 KB
testcase_14 AC 85 ms
76,360 KB
testcase_15 AC 82 ms
76,364 KB
testcase_16 AC 84 ms
76,416 KB
testcase_17 AC 84 ms
76,444 KB
testcase_18 AC 76 ms
75,508 KB
testcase_19 AC 79 ms
76,528 KB
testcase_20 AC 82 ms
76,408 KB
testcase_21 AC 86 ms
76,364 KB
testcase_22 AC 84 ms
76,492 KB
testcase_23 AC 85 ms
76,572 KB
testcase_24 AC 84 ms
76,456 KB
testcase_25 AC 83 ms
76,340 KB
testcase_26 AC 84 ms
76,408 KB
testcase_27 AC 83 ms
76,372 KB
testcase_28 AC 87 ms
76,224 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding:UTF-8
import sys

MOD = 10 ** 9 + 7
INF = float('inf')

D = int(input())    # 数字

res = D
for i in range(1, 70):

    # 二分探索
    imin = 0
    imax = D
    while imax - imin > 1:
        imid = imin + (imax - imin) // 2

        check = imid
        t = imid
        for j in range(i):
            t //= 2
            check += t

        # 2分探索する。
        if check <= D:
            imin = imid
        else:
            imax = imid

    check = imin
    t = imin
    for j in range(i):
        t //= 2
        check += t
    if check == D:
        if res > imin:
            res = imin

print("{}".format(res))
0