結果
問題 | No.2352 Sharpened Knife in Fall |
ユーザー |
![]() |
提出日時 | 2025-03-04 05:54:37 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 642 ms / 3,000 ms |
コード長 | 1,100 bytes |
コンパイル時間 | 394 ms |
コンパイル使用メモリ | 82,296 KB |
実行使用メモリ | 86,368 KB |
最終ジャッジ日時 | 2025-03-04 05:54:54 |
合計ジャッジ時間 | 16,050 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 |
ソースコード
from math import pi, degrees, acosdef area(x1, y1, x2, y2, x3, y3):return abs((x1-x3)*(y2-y3)-(x2-x3)*(y1-y3))/2def vec(a, b):return (b[0]-a[0], b[1]-a[1])def vec2(a):return (a[0]**2+a[1]**2)**0.5def cross_product(v1, v2):return v1[0]*v2[1]-v1[1]*v2[0]def angle(bx, by, ax, ay, cx, cy):ab = vec((ax, ay), (bx, by))ac = vec((ax, ay), (cx, cy))top = ab[0]*ac[0]+ab[1]*ac[1]if cross_product(ab, ac) <= 0:return degrees(acos(top/(vec2(ab)*vec2(ac))))else:return 360-degrees(acos(top/(vec2(ab)*vec2(ac))))R, K = map(int, input().split())A = R**2*pi/(K+1)ans = []for i in range(1, K//2+1):left = -Rright = 0while (right-left) > 1e-7:mid = (left+right)/2x = (R**2-mid**2)**0.5a = angle(x, mid, 0, 0, -x, mid)b = R**2*pi*(a/360)c = area(x, mid, 0, 0, -x, mid)if b-c <= A*i:left = midelse:right = midans.append(left)if K%2 == 1:ans.append(0)for i in range(K//2):ans.append(-ans[K//2-1-i])print(*ans, sep="\n")