B-Integration(待定系数法)
题意很简单。比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(待定系数法)相关推荐
- 2019牛客暑期多校训练营(第一场)(B、C、E、F、H、I题待补、J)
特别感谢 教我C题的杭电大佬.叉姐的题解(看了还是啥也不会) B.Integration(待定系数法) 求上述式子的值,输出对分数取模的值,ai<=1e9,n<=1e3 赛中的时候用裂项拆 ...
- TVM部署和集成Deploy and Integration
TVM部署和集成Deploy and Integration 本文包含如何将TVM部署到各种平台以及如何将其与项目集成. 与传统的深度学习框架不同.TVM堆栈分为两个主要组件: TVM编译器,完成所有 ...
- Verlet Integration
Verlet Integration Verlet 积分法是一种用于求解牛顿运动方程的数值方法,被广泛运用于动力学模拟以及视频游戏中.尔莱算法的优点在于:数值稳定性比简单的欧拉方法高很多,并保持了物理 ...
- 人脸检测--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 ...
- 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. ...
- SAP ECC APO Integration - CIF 简介
SAP ECC & APO Integration - CIF 简介 '
- #翻译NO.3# --- Spring Integration Framework
为什么80%的码农都做不了架构师?>>> 2.4 Message Endpoints A Message Endpoint represents the "filte ...
- matlab--积分integration
int(f):对f的不定积分, 表达式f可以通过先创建变量或引用或直接将字符串传递给int 写答案是记得加上常数项C1等 >> int(x) ans = x^2/2 >> ...
- Jenkins安装maven integration plugin失败解决方法
Jenkins安装maven integration plugin失败解决方法 参考文章: (1)Jenkins安装maven integration plugin失败解决方法 (2)https:// ...
- kmeans python interation flag_Python / Scipy Integration数组
我正在尝试编写一个执行以下操作的程序: >从数组中获取V的值 >将V值传递给相对于E的积分 >将积分结果输出到数组I中 >情节I对抗V 这个等式看起来很讨厌,但除了V. Her ...
最新文章
- 【XLL 文档翻译】【第1部分】 Add-in 管理器 和 XLL 接口函数
- 【AI-1000问】为什么OpenCV读取的图像格式是BGR?
- mysql bundle.tar_linux 下安装mysql-5.7.16-1.el6.x86_64.rpm-bundle.tar
- docker创建rabbitmq容器命令
- php’s fopen() 函数
- Swift傻傻分不清楚系列(三)元组与可选类型
- loadrunner直接压post请求loadrunner直接压post请求
- 使用Apache HttpComponents访问https接口(及老版本DefaultHttpClient deprecated)
- HDU2048 神、上帝以及老天爷【递推】
- linux:记录一次 处理tomcat启动卡死无报错现象的曲折过程
- android手机鼠标,安卓手机变鼠标以及手机控制电脑图文教程
- 红帽Linux7考题,RHCSA题库-RedHat-7.pdf
- echarts地图自动轮播
- 该死!B 站上这些 Java 视频真香!
- Android Bluetooth蓝牙scan过程
- win10 安装硕正
- 科普丨什么是语言?什么是自然语言?
- 手工重建复合文档(.doc;xls,ppt)文件头,修复文件全过程
- 从头开始学51单片机之4:C51程序设计基础
- Thymeleaf 表单回填