結果
問題 | No.2352 Sharpened Knife in Fall |
ユーザー |
![]() |
提出日時 | 2023-06-16 23:09:25 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 323 ms / 3,000 ms |
コード長 | 1,212 bytes |
コンパイル時間 | 227 ms |
コンパイル使用メモリ | 82,232 KB |
実行使用メモリ | 84,520 KB |
最終ジャッジ日時 | 2024-06-24 16:15:25 |
合計ジャッジ時間 | 10,661 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 |
ソースコード
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)