G. GCD Festival∑i=1n∑j=1ngcd(ai,aj)gcd(i,j)∑d=1nd∑i=1nd∑j=1ndgcd(aid,ajd)[gcd(i,j)=1]∑d=1nd∑k=1ndμ(k)∑i=1nkd∑j=1nkdgcd(aikd,ajkd)T
类欧几里得设三个函数f(a,b,c,n)=∑i=0na×i+bc,g(a,b,c,n)=∑i=0ni×a×i+bc,h(a,b,c,n)=∑i=0n(a×i+bc)2f(a, b, c, n) = \sum\limits_{i = 0} ^{n} \frac{a \times i + b}{c},
类欧几里得算法
I. Rise of Shadows一天有HHH个小时,MMM分钟,问,有多少个整数分钟,满足时针与分针的角度≤α\le \alpha≤α,α=2πAHM\alpha = \frac{2 \pi A}{HM}α=HM2πA。
C - Maximize GCD给定长度为n,(2≤3×105)n, (2 \le 3 \times 10 ^ 5)n,(2≤3×105)的数组a,(1≤ai≤3×105)a, (1 \le a_i \le 3 \times 10 ^ 5)a,(1≤ai≤3×105),一个数字K,(1≤K≤1018)K, (
Problem M. Mediocre String Problem给定两个串s,ts, ts,t,要求有多少不同的三元组(i,j,k)(i, j, k)(i,j,k),满足:1≤i≤j≤∣s∣1 \le i \le j \le \mid s \mid1≤i≤j≤∣s∣。1≤k≤∣t∣1 \le k
2019牛客暑期多校训练营(第五场)C generator 2思路x0=x0x_0 = x_0x0=x0x1=a∗x`
树的直径与重心或许更好的阅读体验树的直径求解方法一思路先选取一个点rt作为根节点
P3327 [SDOI2015]约数个数和推导过程求∑i=1n∑j=1md(ij)\sum_{i = 1} ^{n} \sum_{j = 1} ^{m} d(ij)∑i=1n∑j
P6810 「MCOI-02」Convex Hull 凸包思路∑i=1n∑j=1mτ(i)τ(j)τ(gcd(i,j))∑d=1nτ(d)∑i=`
Easy Math Problem推式子∑i=1n∑j=1ngcd(i,j)Klcm(i,j)[gcd(i,j)∈prime]∑i=1n∑j=1ngcd(i,
P3711 仓鼠的数学题有关伯努利数的知识可以看我的上一篇题解链接(写的超详细)
E. The Child and Binary Tree不难写出一个递推式fn=∑i=1ngi∑j=0n−ifjfn−i−jf_n
Residual Polynomial写出所有的fi(x)f_i(x)fi(x)出来,fi,jf_{i, j}fi,j表示fi(x)f_i(x)fi(x)的第jjj项系数
无限手套每种宝石的生成函数为∑n≥0xn(ain2+bin+1)对其进行化简∑n≥0xn+∑n≥0binxn+∑n≥0ain2xn11−x+bix(1−x)2+aix(1+x)(1−x)3最后答案
P4331 [BalticOI 2004]Sequence 数字序列给定一个序列整数a1,a2,a3,…,an−1,ana_1, a_2, a_3, \dots, a_{n - 1}, a_na1,a2,a3,…,an−1,an
苍天阻我寻你,此情坚贞如一给定两个长度为nnn的数组a,ba, ba,b,满足−103≤ai,bi≤103-10 ^ 3 \leq a_i, b_i \leq 10 ^ 3−103≤ai,bi≤103
#6073. 「2017 山东一轮集训 Day5」距离给定一颗有nnn个节点带边权的树
#4604. The kth maximum number给定一个大小不超过5×1055 \times 10 ^ 55×105的矩形区域
H - Hello Ms. Ze给定nnn种不同的材料,第iii种材料有aia_iai个,有mmm个操作,操作分为两类:把第xxx种材料修改为yyy个
A. Slackline Adventure
P4389 付公主的背包考虑生成函数有:∏i=1n11−xvi对其取对数得,∑i=1nln11−xviF(x)=11−xv,G(x)=lnF(x)G(x)=∫F′(x)F(x)dxG(x)=∫vxv−11−xvdxG(x)=∫∑n≥0vxvn+v−1dxG(x)=∑n≥0vxvn+vvn+vG(x)=∑n≥0xv(n+1)n+1G(x)=∑n≥1xvnn对于原式:∑i=1n∑j=1∞xvijj\prod_{i = 1} ^{n} \frac{1}{1 - x ^{v_i}}\\对其取对数得,\s
生成函数可表示为F(x)=∑nankn(x)F(x) = \sum\limits_{n} a_n k_n(x)F(x)=n∑ankn(x),对于不同类型的生成函数,有不同的核函数kn(x)k_n(x)kn(x)。普通生成函数:kn(x)=xnk_n(x) = x ^ nkn(x)=xn。指数生成函数:kn(x)=xnn!k_n(x) = \frac{x ^ n}{n !}kn(x)=n!xn。迪利克雷生成函数:kn(x)=1nxk_n(x) = \frac{1}{n ^ x}kn(x
#include <bits/stdc++.h>using namespace std;const int mod = 998244353, inv2 = mod + 1 >> 1;namespace Quadratic_residue { struct Complex { int r, i; Complex(int _r = 0, int _i = 0) : r(_r), i(_i) {} }; int I2; Complex op
Interesting Series可求得通项Fn=an−1a−1F_n = \frac{a ^ n - 1}{a - 1}Fn=a−1an−1,一个等比数列的前nnn项和,value(s)=Fsum(s)value(s) = F_{sum(s)}value(s)=Fsum(s)。题目要我们求的是Answer(K)=∑s∈subset of S and ∣s∣=Kvalue(s)Answer(K) = \sum\limits_{s \in subset\ o
tokitsukaze and Another Protoss and Zerg考虑生成函数,每一场的生成函数为∑j=1b[i]Cb[i]j+∑j=1a[i]Ca[i]jxj\sum\limits_{j = 1} ^{b[i]}C_{b[i]} ^ j + \sum\limits_{j = 1} ^{a[i]}C_{a[i]} ^{j} x ^ jj=1∑b[i]Cb[i]j+j=1∑a[i]Ca[i]jxj,进一步化简可得2b[i]−1+∑j=1a[i]Ca[i]jxj2 ^{b[i]} -
#3771. Triple考虑只有一个损失时,损失值的生成函数为A(x)A(x)A(x)。如果不考虑无序方案,有两个损失的生成函数为B(x)=A(x)A(x)B(x) =A(x)A(x)B(x)=A(x)A(x),同理有三个的时候C(x)=A(x)A(x)A(x)C(x) = A(x)A(x)A(x)C(x)=A(x)A(x)A(x)。考虑如何得到无序方案:选择两个的时候:ababab的排列有ab,baab, baab,ba两种,我们先减去aa,bbaa, bbaa,bb的然后除以二就是B(x)B
P3978 [TJOI2015]概率论设fif_ifi表示节点数为iii的二叉树有多少,gig_igi表示节点数为iii的二叉树有多少叶子节点。fn=∑i=0n−1fifn−1−if_n = \sum\limits_{i = 0} ^{n - 1}f_if_{n - 1 - i}fn=i=0∑n−1fifn−1−i,f0=1f_0 = 1f0=1。对于ggg我们枚举根节点的左儿子或者右儿子,有gn=2∑i=0n−1fign−1−ig_n = 2\sum\limits_{i = 0} ^{
小 Q 与函数求和 1 ∑i=1n∑j=1nϕ(ijgcd(i,j)K)∑i=1n∑j=1ngcd(i,j)Kϕ(ij)∑i=1n∑j=1ngcd(i,j)Kϕ(i)ϕ(j)gcd(i,j)ϕ(gcd(i,j))∑i=1n∑j=1ngcd(i,j)K+1ϕ(i)ϕ(j)ϕ(gcd(i,j))∑d=1ndK+1inv(ϕ(d))∑i=1nd∑j=1ndϕ(id)ϕ(jd)[gcd(i,j)=1]∑d=1ndK+1inv(phi(d))∑k=1ndϕ(k)∑i=1nkdϕ(ikd)∑j=1nkd
Copyright © 2005-2024 51CTO.COM 版权所有 京ICP证060544号