
数学相关
oier_forever
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Codeforces 840C 题解(DP+组合数学)
题面 C. On the Bench time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output A year ago on the bench in public park Leha found an array of n numbe...原创 2018-05-09 19:02:18 · 564 阅读 · 0 评论 -
Codeforces 1058C(思维+最大公因数)
题面 传送门 分析 引理1:三角形的面积×2\times 2×2一定是整数 由坐标系中的三角形面积公式 S=12(x1y2+x2y3+x3y1−x1y3−x2y1−x3y2)S=\frac{1}{2}(x_1y_2+x_2y_3+x_3y_1-x_1y_3-x_2y_1-x_3y_2)S=21(x1y2+x2y3+x3y1−x1y3−x2y1−x3y2) 显然得证 故若2...原创 2018-09-24 09:54:28 · 626 阅读 · 3 评论 -
BZOJ 1875(DP+矩阵快速幂)
题面 传送门 分析 容易想到根据点来dp 状态转移方程为dp[i]=∑(i,j)∈Edp[j]dp[i]=∑(i,j)∈Edp[j]dp[i]=\sum _{\left( i,j\right) \in E}dp\left[ j\right] 但这样得出的结果是错误的,因为它没有考虑一个点经过多次的情况 因此,我们按边来dp,因为每条边只能经过一次,所以不会出现上面的问题 将无向边...原创 2018-08-29 17:48:40 · 266 阅读 · 0 评论 -
POJ 1905 题解(二分+几何)
题面 传送门 分析 如图:已知AB=L,弧AB=L(1+nC)AB=L,弧AB=L(1+nC)AB=L,弧AB=L(1+nC),M为AB中点,N为圆上一点,且ON垂直于AB于M,求MN 设半径为RRR,∠AOM=θ∠AOM=θ∠AOM=\theta(弧度),MN=xMN=xMN=x 则可列出方程组 ⎧⎩⎨⎪⎪⎪⎪2Rθ=L(1+nc)(1)Rsinθ=L2(2)x=R(1−cosθ...原创 2018-06-13 20:25:10 · 479 阅读 · 1 评论 -
HDU 4549题解 & luogu【模板】矩阵加速(数列)
M斐波那契数列 此题对数学基础要求较高 关于矩阵,请看矩阵乘法_百度百科 设A为m×pm×pm\times p的矩阵,B为p×np×np \times n 的矩阵,那么称m×nm×nm\times n的矩阵C为矩阵A与B的乘积,,其中矩阵C中的第iii 行第 jjj列元素可以表示为: 如下所示: 我们知道斐波那契数列的递推公式f(i)=f(i−1)+f(i...原创 2018-05-05 20:17:15 · 226 阅读 · 0 评论 -
Codeforces 990C (模拟+组合数学)
题面: 传送门 分析: 此题O(n2l)O(n2l)O(n^2l)模拟肯定是会超时的(l为所有字符串总长) 我们想到对字符串进行一定的预处理,可以快速计算匹配 我们设每一个(的值为1,)的值为-1,规定 若只有)括号多了x个,则l[i]=r[i]=-x<0 若只有(括号多了x个,则l[i]=r[i]=x>0 那么如何求l[i],r[i]的值呢? 从左到右扫描字符串,用...原创 2018-06-11 17:35:49 · 386 阅读 · 0 评论 -
Codeforces 601B(贪心+斜率+组合数学+单调栈)
题面 传送门 题目大意: L(h)的值是区间[L,R]内,abs(h[i]-h[j])/(i-j)的最大值。现在有q个询问,每个询问表示询问区间[L,R]内,所有子序列的L(h)的值的和 分析 将∣∣∣h[i]−h[j]i−j∣∣∣|h[i]−h[j]i−j|\left| \dfrac {h\left[ i\right] -h\left[ j\right] }{i-j}\right|想成...原创 2018-05-28 20:42:28 · 180 阅读 · 0 评论 -
Codeforces 979D (STL set)(不用Trie简单AC)
题面: 传送门 题目大意: 给定一个空集合,有两种操作: 一种是往集合中插入一个元素x,一种是给三个数x,k,s,问集合中是否存在v,使得gcd(x,v)%k==0,且x+v&amp;lt;=s若存在多个满足条件,则输出使得v⊕x最大的v。 分析: 首先,gcd(x,v)%k==0,由数论知识得该条件等价于x%k==0&amp;amp;&amp;amp;v%k==0 那么,我们怎么快速求出能整除k的v呢 ...原创 2018-06-02 19:47:29 · 171 阅读 · 0 评论 -
Codeforces 691E题解 DP+矩阵快速幂
题面 E. Xor-sequences time limit per test3 seconds memory limit per test256 megabytes inputstandard input outputstandard output You are given n integers a1, a2, …, an. A sequence of integers x...原创 2018-05-15 20:09:42 · 537 阅读 · 0 评论 -
Codeforces 515C 题解(贪心+数论)(思维题)
题目网址:http://codeforces.com/problemset/problem/515/C Drazil is playing a math game with Varda. Let’s define f(x)f(x) f(x) for positive integer x as a product of factorials of its digits. For example,...原创 2018-05-21 18:34:21 · 613 阅读 · 0 评论 -
Codeforces 475D 题解(二分查找+ST表)
题面: Given a sequence of integers a1, …, an and q queries x1, …, xq on it. For each query xi you have to count the number of pairs (l, r) such that 1 ≤ l ≤ r ≤ n and gcd(al, al + 1, …, ar) = xi. 题目大意...原创 2018-05-21 13:05:47 · 499 阅读 · 0 评论 -
Codeforces 1047C (线性筛+因数分解)
题面 传送门 分析 1.暴力做法 可以O(namax)O(n\sqrt {a_{max}})O(namax)的时间内分解出所有数的质因数,然后统计出现次数最多且次数不为n的质因数,设最多出现次数为x(x≠n)x(x \neq n)x(x̸=n),然后把其他的数去掉就可以了,答案为n−xn-xn−x 例: n=4,a={6,10,15,30}n=4,a=\{6,10,15,30\}n=4,a=...原创 2018-09-22 09:19:39 · 552 阅读 · 0 评论