結果

問題 No.2352 Sharpened Knife in Fall
ユーザー AngrySadEightAngrySadEight
提出日時 2023-03-26 11:53:55
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 2,011 ms / 3,000 ms
コード長 699 bytes
コンパイル時間 183 ms
コンパイル使用メモリ 11,964 KB
実行使用メモリ 12,480 KB
最終ジャッジ日時 2023-10-19 13:37:29
合計ジャッジ時間 25,690 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,388 KB
testcase_01 AC 31 ms
10,324 KB
testcase_02 AC 31 ms
10,388 KB
testcase_03 AC 29 ms
10,324 KB
testcase_04 AC 1,880 ms
12,480 KB
testcase_05 AC 29 ms
10,324 KB
testcase_06 AC 2,011 ms
12,456 KB
testcase_07 AC 1,014 ms
11,476 KB
testcase_08 AC 1,997 ms
12,456 KB
testcase_09 AC 1,983 ms
12,456 KB
testcase_10 AC 1,996 ms
12,472 KB
testcase_11 AC 1,984 ms
12,456 KB
testcase_12 AC 2,008 ms
12,456 KB
testcase_13 AC 2,006 ms
12,456 KB
testcase_14 AC 960 ms
11,424 KB
testcase_15 AC 1,879 ms
12,344 KB
testcase_16 AC 124 ms
10,524 KB
testcase_17 AC 72 ms
10,468 KB
testcase_18 AC 733 ms
11,092 KB
testcase_19 AC 1,570 ms
12,036 KB
testcase_20 AC 628 ms
11,000 KB
testcase_21 AC 606 ms
10,976 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

def area(center, r):
    theta = math.acos(center / r)
    sector = r * r * theta
    triangle = center * ((r ** 2 - center ** 2) ** 0.5)
    return sector - triangle

R, K = map(int, input().split())
p = math.acos(-1)
dr = float(R)
S = dr * dr * p
ans = []

for i in range(K // 2):
    portion_s = S * (i + 1) / (K + 1)

    ok = 0
    ng = dr
    for j in range(50):
        center = (ok + ng) / 2
        if area(center, dr) >= portion_s:
            ok = center
        else:
            ng = center
    ans.append(ok)

for i in range(len(ans)):
    print('{:.13g}'.format(-ans[i]))
if K % 2 == 1:
    print(0)
for i in reversed(range(len(ans))):
    print('{:.13g}'.format(ans[i]))
0