結果

問題 No.1286 Stone Skipping
ユーザー ibyiby
提出日時 2020-11-16 00:29:12
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 471 bytes
コンパイル時間 75 ms
コンパイル使用メモリ 10,748 KB
実行使用メモリ 15,340 KB
最終ジャッジ日時 2023-09-30 07:08:51
合計ジャッジ時間 4,580 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
15,340 KB
testcase_01 AC 16 ms
8,256 KB
testcase_02 AC 17 ms
8,172 KB
testcase_03 AC 16 ms
8,080 KB
testcase_04 AC 16 ms
8,192 KB
testcase_05 AC 16 ms
8,104 KB
testcase_06 AC 16 ms
8,132 KB
testcase_07 AC 16 ms
8,144 KB
testcase_08 AC 16 ms
8,252 KB
testcase_09 AC 16 ms
8,152 KB
testcase_10 AC 16 ms
8,200 KB
testcase_11 AC 16 ms
8,072 KB
testcase_12 AC 16 ms
8,128 KB
testcase_13 AC 16 ms
8,068 KB
testcase_14 AC 16 ms
8,128 KB
testcase_15 AC 20 ms
8,072 KB
testcase_16 AC 17 ms
8,072 KB
testcase_17 AC 16 ms
8,148 KB
testcase_18 AC 16 ms
8,072 KB
testcase_19 AC 16 ms
8,156 KB
testcase_20 AC 16 ms
8,108 KB
testcase_21 AC 16 ms
8,200 KB
testcase_22 AC 17 ms
8,064 KB
testcase_23 TLE -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def distance(L,D):
    res = 0
    v = L
    while L:
        res += L
        L //= 2
        if res == D:
            return True
    return False

def sdistance(L):
    res = 0
    v = L
    while L:
        res += L
        L //= 2
    return res

D = int(input())
l = 0
r = 10**18
while r - l > 1:
    m = (r + l)//2
    if sdistance(m) < D:
        l = m
    else:
        r = m
for i in range(l,l + 1000000):
    if distance(i,D):
        print(i)
        exit()

0