結果

問題 No.2352 Sharpened Knife in Fall
ユーザー maron8676maron8676
提出日時 2023-06-16 23:09:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 378 ms / 3,000 ms
コード長 1,212 bytes
コンパイル時間 512 ms
コンパイル使用メモリ 87,652 KB
実行使用メモリ 86,456 KB
最終ジャッジ日時 2023-09-06 22:02:55
合計ジャッジ時間 13,077 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
72,212 KB
testcase_01 AC 93 ms
71,824 KB
testcase_02 AC 92 ms
72,036 KB
testcase_03 AC 93 ms
71,664 KB
testcase_04 AC 359 ms
85,764 KB
testcase_05 AC 93 ms
71,908 KB
testcase_06 AC 366 ms
85,236 KB
testcase_07 AC 244 ms
82,104 KB
testcase_08 AC 368 ms
85,928 KB
testcase_09 AC 378 ms
85,464 KB
testcase_10 AC 364 ms
85,904 KB
testcase_11 AC 367 ms
85,912 KB
testcase_12 AC 369 ms
85,556 KB
testcase_13 AC 369 ms
85,912 KB
testcase_14 AC 240 ms
81,972 KB
testcase_15 AC 356 ms
86,456 KB
testcase_16 AC 137 ms
78,684 KB
testcase_17 AC 130 ms
78,408 KB
testcase_18 AC 211 ms
80,804 KB
testcase_19 AC 312 ms
84,108 KB
testcase_20 AC 193 ms
80,112 KB
testcase_21 AC 190 ms
79,660 KB
権限があれば一括ダウンロードができます

ソースコード

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 ** (-8) * target:
        if area > target:
            low = mid
        else:
            high = mid

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

    # print(mid)
    ans.append(mid)
    rem = math.pi * R ** 2 / 2 - (len(ans) - 1) * target

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])

for a in ans2:
    print(a)
0