2019NC#1
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,线段树,折线
2019NC#1的更多相关文章
- 2019nc#2
A Eddy Walker 题意 你有n个点(0-n-1),按顺序形成一个环,初始时你在0的位子,你随机顺时针走一步或者逆时针走一步, 一旦你走到一个点后,环上所有点都被经过至少一次后,你就必须停下来 ...
- 2019nc#10
题号 标题 已通过代码 题解/讨论 通过率 团队的状态 A Blackjack 点击查看 背包DP 32/109 补好了 B Coffee Chicken 点击查看 进入讨论 738/2992 通过 ...
- 2019nc#9
题号 标题 已通过代码 题解/讨论 通过率 团队的状态 A The power of Fibonacci 点击查看 进入讨论 69/227 未通过 B Quadratic equation 点击查看 ...
- 2019NC#8
题号 标题 已通过代码 题解/讨论 通过率 团队的状态 A All-one Matrices 点击查看 单调栈+前缀和 326/2017 通过 B Beauty Values 点击查看 进入讨论 8 ...
- 2019nc#7
题号 标题 已通过代码 题解/讨论 通过率 团队的状态 A String 点击查看 进入讨论 566/3539 通过 B Irreducible Polynomial 点击查看 规律 730/229 ...
- 2019nc#6
https://ac.nowcoder.com/acm/contest/886#question 题号 标题 已通过代码 题解/讨论 通过率 团队的状态 A Garbage Classificatio ...
- 2019nc#5
题号 标题 已通过代码 题解/讨论 通过率 团队的状态 A digits 2 点击查看 1017/2384 通过 B generator 1 点击查看 567/3692 通过 C generato ...
- 2019nc#4
题号 标题 已通过代码 题解 通过率 团队的状态 A meeting 点击查看 树直径 604/2055 B xor 点击查看 线段树维护线性基交 81/861 未通过 C sequence 点击 ...
- 2019nc#3
题号 标题 已通过代码 题解/讨论 通过率 团队的状态 A Graph Games 点击查看 进入讨论 18/292 未通过 B Crazy Binary String 点击查看 1107/3615 ...
随机推荐
- yum源使用报错
CentOS系统yum源使用报错:Error: Cannot retrieve repository metadata (repomd.xml) for repository: rpmforge. 服 ...
- 阿里云nas使用记录
公司买了阿里云的nas服务用来共享存储,多个web服务器共同挂载同一个nas服务.挂载过程中出现如下报错 NAS报错: [root@BJ-SBC fs]# mount -t nfs 10.10.8.1 ...
- gulp压缩js文件报错日志
输出 gulp-uglify 压缩js文件时报错信息 gulp.task('es6', function () { return gulp.src('src/main/webapp/bower_com ...
- Android Studio 制作简单的App欢迎页面——基于Android 6.0
在许多的Android App中,我们点击进入时,都可以看到一个欢迎页面,大概持续了几秒,然后跳转至主页面.以下是我开发过程中总结出的一些方法和例子. 一.创建一个新的Activity 首先,新建了一 ...
- windows server2008下搭建ftp服务
在工作中不光使用linux系统下的ftp服务,也得使用windows下的,今天领导让我做一个,踩了很多坑,终于是做完了,重现下过程,我们就来一步一步搭建我们的windows下的ftp服务器: 1.环境 ...
- Apache ActiveMQ 实践 <二>
一.订阅/发布模式 1.生产者 /** * 消息生产者 * */public class JMSProducer { private static final String USERNAME=Acti ...
- 有容云:上车 | 听老司机谈Docker安全合规建设
编者注: 本文根据7月19日DockOne社群分享内容整理而成,分享嘉宾蒋运龙,有容云高级咨询顾问,一个IT的老兵,十年来混迹于存储.三网融合.多屏互动.智能穿戴.第三方支付.Docker等行业:经历 ...
- .net core 基于 IHostedService 实现定时任务
.net core 基于 IHostedService 实现定时任务 Intro 从 .net core 2.0 开始,开始引入 IHostedService,可以通过 IHostedService ...
- python_0基础开始_day03
第三节 一.整形和布尔值的转换 int整型 python3: 全部都是整型 python2: 整型,长整型long 十进制转换二进制 # 将十进制的168转换为二进制 #得出结果 将十进制的168转 ...
- 单元测试python unittest
记录自己学习单元测试框架的一篇博客 菜鸟的学习之路比较艰辛到处找资料一把辛酸泪啊 1.首先是创建一个类里面设计一些简单的函数方便写用例: 原谅我蹩脚的英文直接用拼音命名了 : 2.接着就是创建用例文件 ...