結果

問題 No.1286 Stone Skipping
ユーザー ygd.ygd.
提出日時 2020-11-13 21:55:07
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 720 bytes
コンパイル時間 288 ms
コンパイル使用メモリ 87,088 KB
実行使用メモリ 80,960 KB
最終ジャッジ日時 2023-09-30 02:50:00
合計ジャッジ時間 6,147 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
80,216 KB
testcase_01 AC 75 ms
75,480 KB
testcase_02 AC 75 ms
75,676 KB
testcase_03 AC 76 ms
75,252 KB
testcase_04 AC 74 ms
75,552 KB
testcase_05 AC 76 ms
75,236 KB
testcase_06 AC 75 ms
75,256 KB
testcase_07 AC 76 ms
75,244 KB
testcase_08 AC 75 ms
75,732 KB
testcase_09 AC 75 ms
75,344 KB
testcase_10 AC 75 ms
75,276 KB
testcase_11 AC 74 ms
75,460 KB
testcase_12 AC 75 ms
75,416 KB
testcase_13 AC 76 ms
75,336 KB
testcase_14 AC 77 ms
75,760 KB
testcase_15 AC 77 ms
75,248 KB
testcase_16 AC 75 ms
75,472 KB
testcase_17 AC 77 ms
75,836 KB
testcase_18 AC 76 ms
75,484 KB
testcase_19 AC 75 ms
75,728 KB
testcase_20 AC 75 ms
75,724 KB
testcase_21 AC 76 ms
75,288 KB
testcase_22 AC 78 ms
75,224 KB
testcase_23 TLE -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

D = int(input())
ok = pow(10,20)
ng = 0

def check(x):
    ret = x
    while x > 0:
        x = x//2
        ret += x
    return ret
cnt = 0
while abs(ok-ng) > 1: #and cnt < 100:
    mid = (ok+ng)//2
    #print(ok,mid,ng)
    if check(mid) >= D:
        ok = mid
    else:
        ng = mid
    cnt += 1
ans = ok
#print(ans)

def verify(x,y):
    ret = x
    while x > 0:
        if ret == y:
            return True
        else:
            x = x//2
            ret += x
    if ret == y:
        return True
    else:
        return False
a = ans + 0
b = ans - 0

while True:
    if verify(a,D):
        print(a)
        break
    elif verify(b,D):
        print(b)
        break
    else:
        a += 1
        b -= 1
0