結果

問題 No.2352 Sharpened Knife in Fall
ユーザー 👑 KA37RIKA37RI
提出日時 2023-06-16 23:21:17
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,702 ms / 3,000 ms
コード長 632 bytes
コンパイル時間 242 ms
コンパイル使用メモリ 10,820 KB
実行使用メモリ 14,540 KB
最終ジャッジ日時 2023-09-06 22:22:50
合計ジャッジ時間 27,341 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
8,496 KB
testcase_01 AC 15 ms
8,316 KB
testcase_02 AC 15 ms
8,420 KB
testcase_03 AC 15 ms
8,428 KB
testcase_04 AC 1,688 ms
14,348 KB
testcase_05 AC 15 ms
8,376 KB
testcase_06 AC 1,690 ms
14,512 KB
testcase_07 AC 857 ms
11,776 KB
testcase_08 AC 1,692 ms
14,268 KB
testcase_09 AC 1,687 ms
14,348 KB
testcase_10 AC 1,696 ms
14,540 KB
testcase_11 AC 1,691 ms
14,344 KB
testcase_12 AC 1,702 ms
14,472 KB
testcase_13 AC 1,689 ms
14,480 KB
testcase_14 AC 801 ms
11,756 KB
testcase_15 AC 1,598 ms
13,960 KB
testcase_16 AC 96 ms
8,848 KB
testcase_17 AC 52 ms
8,092 KB
testcase_18 AC 618 ms
10,692 KB
testcase_19 AC 1,333 ms
13,192 KB
testcase_20 AC 531 ms
10,400 KB
testcase_21 AC 503 ms
10,232 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
def area(x):
	return x * math.sqrt(1 - x ** 2) + math.asin(x)
	
def arealine(a):
	l = 0.0
	r = 1.0
	for _ in range(100):
		m = (l + r) / 2
		if area(m) > a:
			r = m
		else:
			l = m
	return l
	
R, N = [int(x) for x in input().split()]
hc = math.pi
ans = []
if N % 2 == 0:
	tmp = [(i + 0.5) / (N + 1) * hc for i in range(N // 2)]
	tmp = [arealine(x) for x in tmp]
	ans.extend(reversed([-t for t in tmp]))
	ans.extend(tmp)
else:
	tmp = [i / (N + 1) * hc for i in range(1, (N + 1) // 2)]
	tmp = [arealine(x) for x in tmp]
	ans.extend(reversed([-t for t in tmp]))
	ans.append(0)
	ans.extend(tmp)
[print(x * R) for x in ans]
0