結果

問題 No.2352 Sharpened Knife in Fall
ユーザー maron8676maron8676
提出日時 2023-06-16 22:52:09
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,130 bytes
コンパイル時間 373 ms
コンパイル使用メモリ 87,640 KB
実行使用メモリ 84,496 KB
最終ジャッジ日時 2023-09-06 21:28:36
合計ジャッジ時間 5,501 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 89 ms
71,872 KB
testcase_02 WA -
testcase_03 AC 90 ms
71,776 KB
testcase_04 TLE -
testcase_05 -- -
testcase_06 -- -
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
from collections import defaultdict, deque
from sys import stdin

readline = stdin.readline


def li():
    return list(map(int, readline().split()))


def calc(y, R):
    angle = math.asin(y / R)
    v1 = 2 * angle / (2 * math.pi) * math.pi * R ** 2
    v2 = math.sin(angle) * math.cos(angle) * R ** 2
    return v1 + v2


# 二分探索?
R, K = li()

target = math.pi * R ** 2 / (K + 1)

# yが+の部分だけ求めれば十分
# 2 * sin-1(y/R)/2*pi * pi * R**2 + sin(sin-1(y/R)) * cos(sin-1(y/R)) * R**2

# print(target)
rem = math.pi * R ** 2 / 2
ans = [R]
while len(ans) - 1 < K // 2:
    low = 0
    high = ans[-1]
    mid = (high + low) / 2
    area = rem - calc(mid, R)

    while abs(area - target) > 10 ** (-7):
        if area > target:
            low = mid
        else:
            high = mid

        mid = (high + low) / 2
        area = rem - calc(mid, R)
        # print(area, mid)

    rem -= area
    ans.append(mid)

ans2 = []
for i in range(1, len(ans)):
    ans2.append(ans[i] * -1)
if K % 2 == 1:
    ans2.append(0)
for i in range(len(ans) - 1, 0, -1):
    ans2.append(ans[i])

print(*ans2)
0