題目連結

https://zerojudge.tw/ShowProblem?problemid=a995

https://onlinejudge.org/index.php?option=onlinejudge&Itemid=8&page=show_problem&problem=1228

參考文章

X

本題要點

用留言區大大提供的數學公式([email protected] (Fer) #25645: 公式)計算就可以了

注意輸入型態是浮點數

輸出要格式化(小數點後十位)

參考解答

解一:

Untitled

import math

while True:
	try:
		n = float(input())
		N1 = n / 2 * math.sqrt(3)
		N2 = n * 3 / (3 + 2 * math.sqrt(3))
		N3 = (n / 2 * math.sqrt(3)) / 2
		N4 = n * (6 * math.sqrt(7) - 7 * math.sqrt(3)) / 10

		print(f"{N1:.10f} {N2:.10f} {N3:.10f} {N4:.10f}")
	except:
		break

回主頁