結果
| 問題 |
No.1319 最強とんがりコーン
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 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 math
def compute_volume(R, H, D):
a = D / (2 * R)
if a >= 1.0:
return 0.0 # No intersection volume
# Pre-calculate frequently used constants
two_R_squared = 2 * R * R
four_R_squared = 4 * R * R
D_squared = D * D
D_div_2 = D / 2
def 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_val
sqrt_val = math.sqrt(four_R_squared * t * t - D_squared)
term2 = D_div_2 * sqrt_val
return term1 - term2
# Use Simpson's rule with a large number of intervals
N = 1000000 # Must be even
a_t = a
b_t = 1.0
h = (b_t - a_t) / N
integral = 0.0
for i in range(N + 1):
t = a_t + i * h
if i == 0 or i == N:
weight = 1
elif i % 2 == 1:
weight = 4
else:
weight = 2
integral += integrand(t) * weight
integral *= h / 3
volume = H * integral
return volume
# Read input
R, H, D = map(float, input().split())
# Compute the volume
volume = compute_volume(R, H, D)
# Output with sufficient precision
print("{0:.9f}".format(volume))
lam6er