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

  1. #include <iostream>
  2. #include <vector>
  3. #include <queue>
  4. using namespace std;
  5. #define pb push_back
  6. #define fi first
  7. #define se second
  8. #define debug(x) cerr<<#x << " := " << x << endl;
  9. #define bug cerr<<"-----------------------"<<endl;
  10. #define FOR(a, b, c) for(int a = b; a <= c; ++ a)
  11.  
  12. typedef long long ll;
  13. typedef long double ld;
  14. typedef pair<int, int> pii;
  15. typedef pair<ll, ll> pll;
  16.  
  17. template<class T> void _R(T &x) { cin >> x; }
  18. void _R(int &x) { scanf("%d", &x); }
  19. void _R(ll &x) { scanf("%lld", &x); }
  20. void _R(double &x) { scanf("%lf", &x); }
  21. void _R(char &x) { scanf(" %c", &x); }
  22. void _R(char *x) { scanf("%s", x); }
  23. void R() {}
  24. template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
  25.  
  26. template<typename T>
  27. inline T read(T&x){
  28. x=;int f=;char ch=getchar();
  29. while (ch<''||ch>'') f|=(ch=='-'),ch=getchar();
  30. while (ch>=''&&ch<='') x=x*+ch-'',ch=getchar();
  31. return x=f?-x:x;
  32. }
  33.  
  34. const int inf = 0x3f3f3f3f;
  35.  
  36. const int mod = 1e9+;
  37.  
  38. /**********showtime************/
  39. const int maxn = 1e3+;
  40. int a[maxn];
  41. ll ksm(ll a, ll b) {
  42. ll res = ;
  43. while(b > ) {
  44. if(b & ) res = res * a % mod;
  45. a = a * a % mod;
  46. b = b >> ;
  47. }
  48. return res;
  49. }
  50. int main(){
  51. int n;
  52. while(~scanf("%d", &n)){
  53. for(int i=; i<=n; i++) scanf("%d", &a[i]);
  54. ll sum = ;
  55. for(int i=; i<=n; i++) {
  56.  
  57. ll tmp = ;
  58. for(int j=; j<=n; j++) {
  59. if(i == j) continue;
  60. ll s = (1ll*a[j] * a[j]%mod - 1ll*a[i]*a[i]%mod + mod)%mod;
  61. tmp = tmp * ksm(s, mod-) % mod;
  62. }
  63. tmp = tmp * ksm(a[i], mod-) % mod;
  64. sum = (sum + tmp )% mod;
  65. }
  66. sum = sum * ksm(, mod-) % mod;
  67. printf("%lld\n", sum);
  68. }
  69. return ;
  70. }

C Euclidean Distance

贪心或者拉格朗日乘子法

D Parity of Tuples

fwt

G Substrings 2

字符串

H XOR

线性基

I Points Division

DP,线段树,折线

2019NC#1的更多相关文章

  1. 2019nc#2

    A Eddy Walker 题意 你有n个点(0-n-1),按顺序形成一个环,初始时你在0的位子,你随机顺时针走一步或者逆时针走一步, 一旦你走到一个点后,环上所有点都被经过至少一次后,你就必须停下来 ...

  2. 2019nc#10

    题号 标题 已通过代码 题解/讨论 通过率 团队的状态 A Blackjack 点击查看 背包DP 32/109 补好了 B Coffee Chicken 点击查看 进入讨论 738/2992  通过 ...

  3. 2019nc#9

    题号 标题 已通过代码 题解/讨论 通过率 团队的状态 A The power of Fibonacci 点击查看 进入讨论 69/227 未通过 B Quadratic equation 点击查看 ...

  4. 2019NC#8

    题号 标题 已通过代码 题解/讨论 通过率 团队的状态 A All-one Matrices 点击查看 单调栈+前缀和 326/2017  通过 B Beauty Values 点击查看 进入讨论 8 ...

  5. 2019nc#7

    题号 标题 已通过代码 题解/讨论 通过率 团队的状态 A String 点击查看 进入讨论 566/3539  通过 B Irreducible Polynomial 点击查看 规律 730/229 ...

  6. 2019nc#6

    https://ac.nowcoder.com/acm/contest/886#question 题号 标题 已通过代码 题解/讨论 通过率 团队的状态 A Garbage Classificatio ...

  7. 2019nc#5

    题号 标题 已通过代码 题解/讨论 通过率 团队的状态 A digits 2 点击查看 1017/2384  通过 B generator 1 点击查看 567/3692  通过 C generato ...

  8. 2019nc#4

    题号 标题 已通过代码 题解 通过率 团队的状态 A meeting 点击查看 树直径 604/2055   B xor 点击查看 线段树维护线性基交 81/861 未通过 C sequence 点击 ...

  9. 2019nc#3

    题号 标题 已通过代码 题解/讨论 通过率 团队的状态 A Graph Games 点击查看 进入讨论 18/292 未通过 B Crazy Binary String 点击查看 1107/3615 ...

随机推荐

  1. yum源使用报错

    CentOS系统yum源使用报错:Error: Cannot retrieve repository metadata (repomd.xml) for repository: rpmforge. 服 ...

  2. 阿里云nas使用记录

    公司买了阿里云的nas服务用来共享存储,多个web服务器共同挂载同一个nas服务.挂载过程中出现如下报错 NAS报错: [root@BJ-SBC fs]# mount -t nfs 10.10.8.1 ...

  3. gulp压缩js文件报错日志

    输出 gulp-uglify 压缩js文件时报错信息 gulp.task('es6', function () { return gulp.src('src/main/webapp/bower_com ...

  4. Android Studio 制作简单的App欢迎页面——基于Android 6.0

    在许多的Android App中,我们点击进入时,都可以看到一个欢迎页面,大概持续了几秒,然后跳转至主页面.以下是我开发过程中总结出的一些方法和例子. 一.创建一个新的Activity 首先,新建了一 ...

  5. windows server2008下搭建ftp服务

    在工作中不光使用linux系统下的ftp服务,也得使用windows下的,今天领导让我做一个,踩了很多坑,终于是做完了,重现下过程,我们就来一步一步搭建我们的windows下的ftp服务器: 1.环境 ...

  6. Apache ActiveMQ 实践 <二>

    一.订阅/发布模式 1.生产者 /** * 消息生产者 * */public class JMSProducer { private static final String USERNAME=Acti ...

  7. 有容云:上车 | 听老司机谈Docker安全合规建设

    编者注: 本文根据7月19日DockOne社群分享内容整理而成,分享嘉宾蒋运龙,有容云高级咨询顾问,一个IT的老兵,十年来混迹于存储.三网融合.多屏互动.智能穿戴.第三方支付.Docker等行业:经历 ...

  8. .net core 基于 IHostedService 实现定时任务

    .net core 基于 IHostedService 实现定时任务 Intro 从 .net core 2.0 开始,开始引入 IHostedService,可以通过 IHostedService ...

  9. python_0基础开始_day03

    第三节 一.整形和布尔值的转换 int整型 python3: 全部都是整型 python2: 整型,长整型long 十进制转换二进制 # 将十进制的168转换为二进制 ​#得出结果 将十进制的168转 ...

  10. 单元测试python unittest

    记录自己学习单元测试框架的一篇博客 菜鸟的学习之路比较艰辛到处找资料一把辛酸泪啊 1.首先是创建一个类里面设计一些简单的函数方便写用例: 原谅我蹩脚的英文直接用拼音命名了 : 2.接着就是创建用例文件 ...