結果

問題 No.2352 Sharpened Knife in Fall
ユーザー nautnaut
提出日時 2023-06-18 03:19:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 443 ms / 3,000 ms
コード長 596 bytes
コンパイル時間 829 ms
コンパイル使用メモリ 87,028 KB
実行使用メモリ 79,204 KB
最終ジャッジ日時 2023-09-07 22:11:46
合計ジャッジ時間 13,325 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
71,736 KB
testcase_01 AC 80 ms
71,612 KB
testcase_02 AC 84 ms
71,676 KB
testcase_03 AC 83 ms
71,580 KB
testcase_04 AC 307 ms
78,224 KB
testcase_05 AC 89 ms
71,476 KB
testcase_06 AC 443 ms
78,708 KB
testcase_07 AC 289 ms
78,580 KB
testcase_08 AC 411 ms
79,012 KB
testcase_09 AC 418 ms
79,204 KB
testcase_10 AC 423 ms
78,276 KB
testcase_11 AC 411 ms
78,200 KB
testcase_12 AC 417 ms
78,460 KB
testcase_13 AC 398 ms
78,680 KB
testcase_14 AC 244 ms
79,128 KB
testcase_15 AC 372 ms
78,404 KB
testcase_16 AC 162 ms
78,160 KB
testcase_17 AC 125 ms
78,308 KB
testcase_18 AC 219 ms
78,288 KB
testcase_19 AC 346 ms
78,500 KB
testcase_20 AC 207 ms
78,172 KB
testcase_21 AC 206 ms
78,540 KB
権限があれば一括ダウンロードができます

ソースコード

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