結果

問題 No.1286 Stone Skipping
ユーザー neterukunneterukun
提出日時 2020-11-13 21:53:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 83 ms / 2,000 ms
コード長 404 bytes
コンパイル時間 430 ms
コンパイル使用メモリ 87,068 KB
実行使用メモリ 76,808 KB
最終ジャッジ日時 2023-09-30 16:06:40
合計ジャッジ時間 3,896 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
75,760 KB
testcase_01 AC 75 ms
75,416 KB
testcase_02 AC 80 ms
76,472 KB
testcase_03 AC 83 ms
76,384 KB
testcase_04 AC 80 ms
76,472 KB
testcase_05 AC 80 ms
76,704 KB
testcase_06 AC 79 ms
76,728 KB
testcase_07 AC 78 ms
76,528 KB
testcase_08 AC 78 ms
76,280 KB
testcase_09 AC 80 ms
76,728 KB
testcase_10 AC 79 ms
76,280 KB
testcase_11 AC 79 ms
76,592 KB
testcase_12 AC 79 ms
76,660 KB
testcase_13 AC 81 ms
76,592 KB
testcase_14 AC 80 ms
76,556 KB
testcase_15 AC 81 ms
76,808 KB
testcase_16 AC 80 ms
76,588 KB
testcase_17 AC 81 ms
76,652 KB
testcase_18 AC 73 ms
75,384 KB
testcase_19 AC 75 ms
75,356 KB
testcase_20 AC 80 ms
76,688 KB
testcase_21 AC 81 ms
76,676 KB
testcase_22 AC 81 ms
76,568 KB
testcase_23 AC 83 ms
76,724 KB
testcase_24 AC 82 ms
76,568 KB
testcase_25 AC 82 ms
76,604 KB
testcase_26 AC 81 ms
76,736 KB
testcase_27 AC 81 ms
76,616 KB
testcase_28 AC 79 ms
76,564 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

d = int(input())

def solve(mid, cnt):
    val = 0
    for i in range(cnt):
        val += mid
        mid >>= 1
    return val >= d, val

ans = d
for cnt in range(100):
    ok = d
    ng = 0
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        if solve(mid, cnt)[0]:
            ok = mid
        else:
            ng = mid
    if solve(ok, cnt)[1] == d:
        ans = min(ok, ans)
print(ans)
0