結果

問題 No.2352 Sharpened Knife in Fall
ユーザー nautnaut
提出日時 2023-06-18 03:17:06
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 608 bytes
コンパイル時間 804 ms
コンパイル使用メモリ 10,932 KB
実行使用メモリ 13,388 KB
最終ジャッジ日時 2023-09-07 22:08:13
合計ジャッジ時間 10,119 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
12,424 KB
testcase_01 AC 16 ms
8,024 KB
testcase_02 AC 16 ms
8,044 KB
testcase_03 AC 16 ms
8,076 KB
testcase_04 AC 2,925 ms
8,004 KB
testcase_05 AC 16 ms
7,960 KB
testcase_06 TLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
権限があれば一括ダウンロードができます

ソースコード

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