結果
| 問題 |
No.2352 Sharpened Knife in Fall
|
| コンテスト | |
| ユーザー |
maron8676
|
| 提出日時 | 2023-06-16 22:53:31 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,145 bytes |
| コンパイル時間 | 243 ms |
| コンパイル使用メモリ | 82,496 KB |
| 実行使用メモリ | 86,356 KB |
| 最終ジャッジ日時 | 2024-06-24 15:51:35 |
| 合計ジャッジ時間 | 5,139 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 1 TLE * 1 -- * 17 |
ソースコード
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])
for a in ans2:
print(a)
maron8676