HBC237448[HEOI2012]采花,数据结构,线段树,树状数组gcds题解

别敷衍了所有 算法基础篇 52 0
想要成为编程高手?那就来试试全网最全C++题库,让您在练习中快速成长。
For any positive integer sequence a1,a2,,ama_1,a_2,cdots,a_ma1,a2,,am, define its weight f=∑i>1gcdwf=sum_{i>1} gcdcdot wf=∑i>1gcdw, Here w=px3+qx2+rxw=px^3+qx^2+rxw=px3+qx2+rx. p,q,r,mp,q,r,mp,q,r,m are given constants, Calculate the sum of the weight of all such sequences whose sum is nnn, The answer might be very huge, print it module 109+710^9+7109+7.

For any positive integer sequence a1,a2,⋯ ,ama_1,a_2,cdots,a_ma1​,a2​,⋯,am​, define its weight f(a)=∑i>1gcd⁡(ai,ai−1)⋅w(ai)f(a)=sum_{i>1} gcd(a_i,a_{i-1})cdot w(a_i)f(a)=∑i>1​gcd(ai​,ai−1​)⋅w(ai​)。 Here w(x)=px3+qx2+rxw(x)=px^3+qx^2+rxw(x)=px3+qx2+rx. p,q,r,mp,q,r,mp,q,r,m are given constants。 Calculate the sum of the weight of all such sequences whose sum is nnn。 The answer might be very huge, print it module 109+710^9+7109+7.

HBC237448[HEOI2012]采花,数据结构,线段树,树状数组gcds题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
想要在职场中立于不败之地?那就来试试全网最全C++题库,让您在练习中快速提升技能。

标签: HBC237448[HEOI2012]采花 数据结构 线段树 树状数组gcds题解