結果
問題 | No.1319 最強とんがりコーン |
ユーザー |
![]() |
提出日時 | 2025-03-26 15:56:56 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,233 bytes |
コンパイル時間 | 178 ms |
コンパイル使用メモリ | 82,360 KB |
実行使用メモリ | 76,648 KB |
最終ジャッジ日時 | 2025-03-26 15:57:15 |
合計ジャッジ時間 | 9,057 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 53 RE * 17 |
ソースコード
import mathdef compute_volume(R, H, D):a = D / (2 * R)if a >= 1.0:return 0.0 # No intersection volume# Pre-calculate frequently used constantstwo_R_squared = 2 * R * Rfour_R_squared = 4 * R * RD_squared = D * DD_div_2 = D / 2def integrand(t):arg = D / (2 * R * t)arg_clipped = max(min(arg, 1.0), -1.0)acos_val = math.acos(arg_clipped)term1 = two_R_squared * (t ** 2) * acos_valsqrt_val = math.sqrt(four_R_squared * t * t - D_squared)term2 = D_div_2 * sqrt_valreturn term1 - term2# Use Simpson's rule with a large number of intervalsN = 1000000 # Must be evena_t = ab_t = 1.0h = (b_t - a_t) / Nintegral = 0.0for i in range(N + 1):t = a_t + i * hif i == 0 or i == N:weight = 1elif i % 2 == 1:weight = 4else:weight = 2integral += integrand(t) * weightintegral *= h / 3volume = H * integralreturn volume# Read inputR, H, D = map(float, input().split())# Compute the volumevolume = compute_volume(R, H, D)# Output with sufficient precisionprint("{0:.9f}".format(volume))