結果

問題 No.2352 Sharpened Knife in Fall
ユーザー AngrySadEightAngrySadEight
提出日時 2023-03-26 11:54:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 371 ms / 3,000 ms
コード長 699 bytes
コンパイル時間 371 ms
コンパイル使用メモリ 81,844 KB
実行使用メモリ 78,296 KB
最終ジャッジ日時 2023-10-19 13:37:40
合計ジャッジ時間 7,136 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,788 KB
testcase_01 AC 35 ms
53,680 KB
testcase_02 AC 36 ms
53,788 KB
testcase_03 AC 35 ms
53,680 KB
testcase_04 AC 359 ms
78,264 KB
testcase_05 AC 36 ms
53,680 KB
testcase_06 AC 371 ms
78,292 KB
testcase_07 AC 221 ms
77,288 KB
testcase_08 AC 362 ms
78,284 KB
testcase_09 AC 368 ms
78,292 KB
testcase_10 AC 358 ms
78,296 KB
testcase_11 AC 360 ms
78,284 KB
testcase_12 AC 361 ms
78,288 KB
testcase_13 AC 363 ms
78,288 KB
testcase_14 AC 211 ms
77,292 KB
testcase_15 AC 345 ms
78,268 KB
testcase_16 AC 90 ms
76,484 KB
testcase_17 AC 84 ms
76,588 KB
testcase_18 AC 180 ms
76,892 KB
testcase_19 AC 297 ms
78,256 KB
testcase_20 AC 162 ms
76,612 KB
testcase_21 AC 165 ms
76,620 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