Type: Default 1000ms 512MiB

【USTCPC2025】D. 数学分析

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

image

题目描述

克露丝卡尔酱在中科大偶遇数学分析,拼尽全力无法战胜!请帮助她解决以下问题,帮助她不要挂科!

请编写程序计算 01P(x)x2+1dx\displaystyle\int_{0}^1\frac{P(x)}{x^2+1}dx

其中,P(x)P(x) 为输入给定的多项式。P(x)=a0+a1x+a2x2++anxnP(x)=a_0+a_1x+a_2x^2+\cdots+a_nx^n

输入格式

输入第一行一个非负整数 nn (0n105)(0\le n\le 10^5) 表示多项式的次数。

输入第二行有 n+1n+1整数 a0,a1,,ana_0,a_1,\dots,a_n (104ai104)(-10^4\le a_i\le 10^4)

输出格式

输出一行,即为积分的值。

特别地,你的答案被视为正确当且仅当绝对误差或相对误差不超过 10610^{-6}。正式地说,令你的答案为 xx,评测机的答案为 yy。你的答案视为正确当且仅当 xymax(1,y)106\dfrac{|x-y|}{\max(1,|y|)}\le 10^{-6}

样例

input:

2
5 2 1

output:

4.8347398341

input:

0
4

output:

3.1415926536

提示

$\displaystyle\int_{0}^1\frac{x^2+2x+5}{x^2+1}dx=\pi+\ln2+1\approx 4.8347398341$

USTCPC2025 线上赛

Not Attended
Status
Done
Rule
ACM/ICPC
Problem
15
Start at
2025-3-23 19:00
End at
2025-3-30 12:00
Duration
161 hour(s)
Host
Partic.
103