> 旅游
等差数列的前项积的公式(等差数列的前项积怎么求)
等差数列的前N项积
题面
![等差数列的前n项积的公式(等差数列的前n项积怎么求) 等差数列的前n项积的公式(等差数列的前n项积怎么求)](http://image.lingbiren.com/d/file/p/2023/10/200929168195418711324.png)
Problem Statement
![等差数列的前n项积的公式(等差数列的前n项积怎么求) 等差数列的前n项积的公式(等差数列的前n项积怎么求)](http://image.lingbiren.com/d/file/p/2023/10/200929168195418828197.png)
Input/Output
![等差数列的前n项积的公式(等差数列的前n项积怎么求) 等差数列的前n项积的公式(等差数列的前n项积怎么求)](http://image.lingbiren.com/d/file/p/2023/10/200929168195418828992.png)
题意
给出等差数列的首项x,公差d,项数n。
求该等差数列的前n项积
分析
从模数为1e6+3出发
很显然算法复杂度是一个多log的或者更优的写法。
d=0 ans = ksm(x,n)d != 0![等差数列的前n项积的公式(等差数列的前n项积怎么求) 等差数列的前n项积的公式(等差数列的前n项积怎么求)](http://image.lingbiren.com/d/file/p/2023/10/200929168195418830272.jpg)
d != 0
x / d + (n - 1) >= modans = 0![等差数列的前n项积的公式(等差数列的前n项积怎么求) 等差数列的前n项积的公式(等差数列的前n项积怎么求)](http://image.lingbiren.com/d/file/p/2023/10/200929168195418990479.png)
Pre_Init
![等差数列的前n项积的公式(等差数列的前n项积怎么求) 等差数列的前n项积的公式(等差数列的前n项积怎么求)](http://image.lingbiren.com/d/file/p/2023/10/200929168195418912132.png)
Solve
温馨提示:通过以上关于等差数列的前N项积内容介绍后,相信大家有新的了解,更希望可以对你有所帮助。