题意很简单。比C好想一点。

就是叫你求积分

这个我们队积分里面的分式进行处理,根据代数学和待定系数法。

我们可以得到这样一个式子

然后在观察这个式子

剩下的就是系数问题了假设我们求Ak

我们乘一个

然后式子变形成这样

然后令x^2=-ak^2就可以得到Ak了

不要以为x^2不能等于负数,这里的x^2只是一个值而已,式子是成立的。

这样求出了系数这道就不难了。

#include "bits/stdc++.h"using namespace std;
const double eps = 1e-8;
#define lowbit(x) x&-xint dcmp(double x) {if (fabs(x) < eps) return 0;return (x > 0) ? 1 : -1;
}typedef long long ll;
typedef unsigned long long ull;
const ull hash1 = 201326611;
const ull hash2 = 50331653;
const int N = 100000 + 10;
const int M = 2048 + 10;
const int inf = 0x3f3f3f3f;
const ll mod = 1e9 + 7;ll n, a[N];
ll k[N], d[N];ll quick(ll a, ll n) {ll ans = 1;while (n) {if (n & 1) ans = ans * a % mod;n >>= 1;a = a * a % mod;}return ans;
}int main() {while (~scanf("%lld", &n)) {for (int i = 1; i <= n; i++) {scanf("%lld", &a[i]);}for (int i = 1; i <= n; i++) {ll tmp = a[i] * a[i] % mod;k[i] = 1;for (int j = 1; j <= n; j++) {if (i == j) continue;k[i] = k[i] * ((a[j] * a[j] % mod - tmp + mod) % mod) % mod;}k[i] = k[i] * a[i] % mod;}ll tt = 1;for (int i = 1; i <= n; i++) {tt = tt * k[i] % mod;d[i] = 1;for (int j = 1; j <= n; j++) {if (i == j) continue;d[i] = k[j] * d[i] % mod;}}ll p = 0, q = tt;q = tt * 2 % mod;for (int i = 1; i <= n; i++) p = (p + d[i]) % mod;ll ans = p * quick(q, mod - 2) % mod;printf("%lld\n", ans);}return 0;
}

B-Integration(待定系数法)相关推荐

  1. 2019牛客暑期多校训练营(第一场)(B、C、E、F、H、I题待补、J)

    特别感谢 教我C题的杭电大佬.叉姐的题解(看了还是啥也不会) B.Integration(待定系数法) 求上述式子的值,输出对分数取模的值,ai<=1e9,n<=1e3 赛中的时候用裂项拆 ...

  2. TVM部署和集成Deploy and Integration

    TVM部署和集成Deploy and Integration 本文包含如何将TVM部署到各种平台以及如何将其与项目集成. 与传统的深度学习框架不同.TVM堆栈分为两个主要组件: TVM编译器,完成所有 ...

  3. Verlet Integration

    Verlet Integration Verlet 积分法是一种用于求解牛顿运动方程的数值方法,被广泛运用于动力学模拟以及视频游戏中.尔莱算法的优点在于:数值稳定性比简单的欧拉方法高很多,并保持了物理 ...

  4. 人脸检测--Face Detection with End-to-End Integration of a ConvNet and a 3D Model

    Face Detection with End-to-End Integration of a ConvNet and a 3D Model ECCV2016 mxnet code:https://g ...

  5. SAP CAR integration with S/4 HANA

    As you may be aware SAP CAR can be integrated with the below SAP components Inbound(into SAP CAR) 1. ...

  6. SAP ECC APO Integration - CIF 简介

    SAP ECC & APO Integration - CIF 简介 '

  7. #翻译NO.3# --- Spring Integration Framework

    为什么80%的码农都做不了架构师?>>>    2.4 Message Endpoints A Message Endpoint represents the "filte ...

  8. matlab--积分integration

    int(f):对f的不定积分, 表达式f可以通过先创建变量或引用或直接将字符串传递给int 写答案是记得加上常数项C1等 >> int(x)   ans =   x^2/2 >> ...

  9. Jenkins安装maven integration plugin失败解决方法

    Jenkins安装maven integration plugin失败解决方法 参考文章: (1)Jenkins安装maven integration plugin失败解决方法 (2)https:// ...

  10. kmeans python interation flag_Python / Scipy Integration数组

    我正在尝试编写一个执行以下操作的程序: >从数组中获取V的值 >将V值传递给相对于E的积分 >将积分结果输出到数组I中 >情节I对抗V 这个等式看起来很讨厌,但除了V. Her ...

最新文章

  1. 【XLL 文档翻译】【第1部分】 Add-in 管理器 和 XLL 接口函数
  2. 【AI-1000问】为什么OpenCV读取的图像格式是BGR?
  3. mysql bundle.tar_linux 下安装mysql-5.7.16-1.el6.x86_64.rpm-bundle.tar
  4. docker创建rabbitmq容器命令
  5. php’s fopen() 函数
  6. Swift傻傻分不清楚系列(三)元组与可选类型
  7. loadrunner直接压post请求loadrunner直接压post请求
  8. 使用Apache HttpComponents访问https接口(及老版本DefaultHttpClient deprecated)
  9. HDU2048 神、上帝以及老天爷【递推】
  10. linux:记录一次 处理tomcat启动卡死无报错现象的曲折过程
  11. android手机鼠标,安卓手机变鼠标以及手机控制电脑图文教程
  12. 红帽Linux7考题,RHCSA题库-RedHat-7.pdf
  13. echarts地图自动轮播
  14. 该死!B 站上这些 Java 视频真香!
  15. Android Bluetooth蓝牙scan过程
  16. win10 安装硕正
  17. 科普丨什么是语言?什么是自然语言?
  18. 手工重建复合文档(.doc;xls,ppt)文件头,修复文件全过程
  19. 从头开始学51单片机之4:C51程序设计基础
  20. Thymeleaf 表单回填

热门文章

  1. DAX 第四篇:CALCULATE详解
  2. MacOS Knowledge
  3. 李嘉诚长江商学院演讲汇总:大时代下的商道
  4. 成年人必须看的5个故事
  5. 小马识途谈如何利用全网营销打造营销闭环
  6. Qt之arm使用openssl(RSA加密)
  7. 一堆被称之为大学的东西——思想和精神(送给不仅仅是计算机专业的同学)
  8. 郑良老师在行人重识别的一篇综述论文中引用的典故翻译
  9. 张小龙微信公开课PRO演讲:信息互联的7个思考
  10. 达观数据自然语言处理框架