LINK

B Integration

题意:

给定$a_1,a_2,...,a_n$, 计算 $$\frac{1}{π}\int_{0}^{\infty}\frac{1}{\prod\limits_{i=1}^{n}(a_i^2+x^2)}dx$$ 在mod(1E9+7)意义下的答案。

思路:

裂项化乘为和的方法

可以得到

$$\frac{1}{2}\sum_{i=1}^n \quad  \frac{1}{\prod_{j=1,j \ne i}^n \quad a_j^2 - a_i^2} \quad \frac{1}{a_i}$$

参考:https://www.cnblogs.com/Dillonh/p/11209476.html

#include <iostream>
#include <vector>
#include <queue>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define debug(x) cerr<<#x << " := " << x << endl;
#define bug cerr<<"-----------------------"<<endl;
#define FOR(a, b, c) for(int a = b; a <= c; ++ a) typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll; template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(ll &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); } template<typename T>
inline T read(T&x){
x=;int f=;char ch=getchar();
while (ch<''||ch>'') f|=(ch=='-'),ch=getchar();
while (ch>=''&&ch<='') x=x*+ch-'',ch=getchar();
return x=f?-x:x;
} const int inf = 0x3f3f3f3f; const int mod = 1e9+; /**********showtime************/
const int maxn = 1e3+;
int a[maxn];
ll ksm(ll a, ll b) {
ll res = ;
while(b > ) {
if(b & ) res = res * a % mod;
a = a * a % mod;
b = b >> ;
}
return res;
}
int main(){
int n;
while(~scanf("%d", &n)){
for(int i=; i<=n; i++) scanf("%d", &a[i]);
ll sum = ;
for(int i=; i<=n; i++) { ll tmp = ;
for(int j=; j<=n; j++) {
if(i == j) continue;
ll s = (1ll*a[j] * a[j]%mod - 1ll*a[i]*a[i]%mod + mod)%mod;
tmp = tmp * ksm(s, mod-) % mod;
}
tmp = tmp * ksm(a[i], mod-) % mod;
sum = (sum + tmp )% mod;
}
sum = sum * ksm(, mod-) % mod;
printf("%lld\n", sum);
}
return ;
}

C Euclidean Distance

贪心或者拉格朗日乘子法

D Parity of Tuples

fwt

G Substrings 2

字符串

H XOR

线性基

I Points Division

DP,线段树,折线

最新文章

  1. presto-elasticsearch connector
  2. MyEclipse中如何安装插件(以Subclipse为例)[转]
  3. MS SQL中使用UPDATE ... INNER JOIN ...
  4. Windows 服务开发框架介绍 - Topshelf
  5. Hql查询结果动态组装 List(map),List(bean),List(list),List(set)等格式(转)
  6. 千份位Javascript Thousand Separator / string format
  7. C#中value是什么意思
  8. Core Java Volume I — 5.1. Classes, Superclasses, and Subclasses
  9. sgu548 Dragons and Princesses   贪心+优先队列
  10. Learning Scrapy笔记(零) - 前言
  11. PHP常用文件函数和目录函数整理
  12. BestCoder Round #67 (div.2) N bulbs(hdu 5600)
  13. 加密解密以及CA签证
  14. Base64的用法
  15. mongo db安装和php,python插件安装
  16. Qt编程之右键单击QTreeWidgetItem弹出菜单
  17. php.ini 全站,和htaccess web目录 默认头部和尾部 auto_prepend_file
  18. java 访问后台方法顺序混乱
  19. Exclusive-OR(带权并查集)
  20. nginx编译参数的内容

热门文章

  1. 【iOS】UIAlertController 弹出框
  2. 并发栅栏CyclicBarrier---简单问2
  3. 调测Onvif事件总结解决办法
  4. Tomcat源码分析 (一)----- 手写一个web服务器
  5. Serilog 自定义Enricher 来增加记录的信息
  6. Go中的fmt几种输出的区别和格式化方式
  7. Java——字符串
  8. 初识JavaScript和面向对象
  9. shell 提取文件名和目录名
  10. cs231n官方note笔记