結果

問題 No.2352 Sharpened Knife in Fall
ユーザー ntudantuda
提出日時 2023-06-17 11:17:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 774 ms / 3,000 ms
コード長 633 bytes
コンパイル時間 294 ms
コンパイル使用メモリ 87,212 KB
実行使用メモリ 81,884 KB
最終ジャッジ日時 2023-09-07 08:29:55
合計ジャッジ時間 17,471 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,724 KB
testcase_01 AC 71 ms
71,884 KB
testcase_02 AC 71 ms
71,740 KB
testcase_03 AC 70 ms
71,812 KB
testcase_04 AC 525 ms
81,568 KB
testcase_05 AC 74 ms
71,688 KB
testcase_06 AC 774 ms
81,284 KB
testcase_07 AC 440 ms
79,712 KB
testcase_08 AC 767 ms
81,532 KB
testcase_09 AC 773 ms
81,288 KB
testcase_10 AC 769 ms
81,808 KB
testcase_11 AC 774 ms
81,836 KB
testcase_12 AC 769 ms
81,884 KB
testcase_13 AC 743 ms
81,280 KB
testcase_14 AC 388 ms
79,932 KB
testcase_15 AC 672 ms
81,236 KB
testcase_16 AC 149 ms
77,704 KB
testcase_17 AC 134 ms
77,888 KB
testcase_18 AC 343 ms
79,316 KB
testcase_19 AC 616 ms
80,420 KB
testcase_20 AC 307 ms
78,952 KB
testcase_21 AC 310 ms
79,192 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import *

def check(y, S):
    global theta
    x = (R * R - y * y) ** 0.5
    if y == 0:
        s = S0 / 2
    elif y > 0:
        theta = atan(x / y)
        s = R * R * theta - y * x
    else:
        y = -y
        theta = atan(x / y)
        s = S0 - R * R * theta + y * x
    return s < S

R, K = map(int, input().split())
S0 = pi * R * R
SP = S0 / (K + 1)
ans = []
ST = S0
for i in range(K):
    ST -= SP
    lb = -R
    ub = R
    while ub - lb > 0.000001:
        mid = (lb + ub) / 2
        if check(mid, ST):
            ub = mid
        else:
            lb = mid
    ans.append(lb)
for a in ans:
    print(a)
0