結果

問題 No.2352 Sharpened Knife in Fall
ユーザー naut3
提出日時 2023-06-18 03:19:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 366 ms / 3,000 ms
コード長 596 bytes
コンパイル時間 181 ms
コンパイル使用メモリ 82,436 KB
実行使用メモリ 77,484 KB
最終ジャッジ日時 2024-06-25 15:48:37
合計ジャッジ時間 10,921 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

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 = R * R * theta / 2

        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