Cattle off more school first B Inergratiion
Portal: https://ac.nowcoder.com/acm/contest/881/B
Meaning of the questions:
Give you a [ evaluates how much
answer:
According to knowledge generation line
We can split the denominator item, then according to
\(\int_{0}^{\infty} \frac{1}{1+x^2}dx=\frac{\pi}{2}-->\int_{0}^{\infty} \frac{1}{1+\frac{x}{a_i}^2}d\frac{x}{a_i}=\frac{\pi}{2}\)
You can push
Our answer is to find out the split coefficient multiplied by \ (\ frac {\ pi} {2} \)
Details see God derivation D bar
https://www.cnblogs.com/Dillonh/p/11209476.html#4304562
Code:
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
#include <string>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef unsigned long long uLL;
#define ls rt<<1
#define rs rt<<1|1
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define bug printf("*********\n")
#define FIN freopen("input.txt","r",stdin);
#define FON freopen("output.txt","w+",stdout);
#define IO ios::sync_with_stdio(false),cin.tie(0)
#define debug1(x) cout<<"["<<#x<<" "<<(x)<<"]\n"
#define debug2(x,y) cout<<"["<<#x<<" "<<(x)<<" "<<#y<<" "<<(y)<<"]\n"
#define debug3(x,y,z) cout<<"["<<#x<<" "<<(x)<<" "<<#y<<" "<<(y)<<" "<<#z<<" "<<z<<"]\n"
const int maxn = 3e5 + 5;
const int INF = 0x3f3f3f3f;
const int mod = 1e9 + 7;
LL quick_pow(LL x, LL y) {
LL ans = 1;
while(y) {
if(y & 1) {
ans = ans * x % mod;
} x = x * x % mod;
y >>= 1;
} return ans;
}
LL a[maxn];
int main() {
#ifndef ONLINE_JUDGE
FIN
#endif
int n;
while(scanf("%d", &n) != EOF) {
for(int i = 0; i < n; i++) {
scanf("%lld", &a[i]);
}
LL ans = 0;
for(int i = 0; i < n; i++) {
LL tmp = 1;
for(int j = 0; j < n; j++) {
if(i == j) continue;
tmp = (tmp * (quick_pow(a[j], 2) % mod - quick_pow(a[i], 2) % mod + mod) % mod) % mod;
}
tmp = tmp * 2 % mod * a[i] % mod;
ans = (ans + quick_pow(tmp, mod - 2) + mod) % mod;
}
printf("%lld\n", (ans + mod) % mod);
}
return 0;
}