結果

問題 No.1286 Stone Skipping
ユーザー ygd.ygd.
提出日時 2020-11-13 21:38:48
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 636 bytes
コンパイル時間 590 ms
コンパイル使用メモリ 87,104 KB
実行使用メモリ 80,648 KB
最終ジャッジ日時 2023-09-30 02:38:45
合計ジャッジ時間 6,453 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
79,732 KB
testcase_01 AC 75 ms
75,356 KB
testcase_02 AC 76 ms
75,248 KB
testcase_03 AC 75 ms
75,156 KB
testcase_04 AC 75 ms
75,468 KB
testcase_05 AC 77 ms
75,296 KB
testcase_06 AC 76 ms
75,192 KB
testcase_07 AC 76 ms
75,236 KB
testcase_08 AC 76 ms
75,244 KB
testcase_09 AC 76 ms
75,244 KB
testcase_10 AC 77 ms
75,252 KB
testcase_11 AC 76 ms
75,224 KB
testcase_12 AC 76 ms
75,312 KB
testcase_13 AC 76 ms
75,356 KB
testcase_14 AC 75 ms
75,100 KB
testcase_15 AC 76 ms
75,108 KB
testcase_16 AC 75 ms
75,252 KB
testcase_17 AC 75 ms
75,104 KB
testcase_18 AC 75 ms
75,284 KB
testcase_19 AC 73 ms
75,188 KB
testcase_20 AC 73 ms
75,196 KB
testcase_21 AC 75 ms
75,196 KB
testcase_22 AC 78 ms
75,228 KB
testcase_23 TLE -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

D = int(input())
ok = pow(10,18)*2
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

while True:
    if verify(ans,D):
        print(ans)
        break
    else:
        ans += 1
0