链接:
来源:牛客网
Integration
时间限制:C/C++ 2秒,其他语言4秒
空间限制:C/C++ 524288K,其他语言1048576K
64bit IO Format: %lld
题目描述
Bobo knows that
∫
∞
0
1
1
d
x
=
π
2
.
∫0∞11+x2 dx=π2.
Given n distinct positive integers
a
1
,
a
2
,
…
,
a
n
a1,a2,…,an, find the value of
1
π
∫
∞
0
1
∏
n
i
=
1
(
a
2
i
d
x
.
1π∫0∞1∏i=1n(ai2+x2) dx.
It can be proved that the value is a rational number
p
q
pq.
Print the result as
(
p
⋅
q
−
1
)
mod
(
10
9
- 7 ) (p⋅q−1)mod(109+7). 输入描述: The input consists of several test cases and is terminated by end-of-file.
The first line of each test case contains an integer n.
The second line contains n integers
a
1
,
a
2
,
…
,
a
n
a1,a2,…,an.
- 1 ≤ n ≤ 10 3 1≤n≤103
- 1 ≤ a i ≤ 10 9 1≤ai≤109
- { a 1 , a 2 , … , a n } {a1,a2,…,an} are distinct.
- The sum of n 2 n2 does not exceed 10 7
- 输出描述: For each test case, print an integer which denotes the result. 示例1 输入 复制 1 1 1 2 2 1 2 输出 复制 500000004 250000002 83333334
题意:
思路:
事实上我并不会上面的处理,真正积分的话要用裂项相消来出来。
但是有强大的自动积分软件啊:
输入一个n=5的 情况,就可以看出规律。
细节见代码:
#include #include #include #include #include #include #include #include