結果

問題 No.2352 Sharpened Knife in Fall
ユーザー naut3
提出日時 2023-06-18 03:17:06
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 608 bytes
コンパイル時間 217 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 16,384 KB
最終ジャッジ日時 2024-06-25 15:45:13
合計ジャッジ時間 9,568 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 2 TLE * 2 -- * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

R, K = map(int, input().split())
PI = math.pi

for i in range(K):
    S = PI * R * R * (i+1) / (K+1)

    ok = -R
    ng = R

    while ng - ok > 0.000001:
        h = (ok + ng) / 2

        if h < 0:
            theta = 2 * math.acos(abs(h) / R)
        else:
            theta = 2 * (PI - math.acos(abs(h) / R))

        T = PI * R * R * theta / (2 * PI)

        if h < 0:
            T -= math.sqrt(R * R - h * h) * abs(h)
        else:
            T += math.sqrt(R * R - h * h) * abs(h)

        if S < T:
            ng = h
        else:
            ok = h

    print("{:.7f}".format(ok))
0