题目:http://www.lydsy.com/JudgeOnline/problem.php?id=3328题解:关键在于只处理i%k的项,那么我们就需要用一个式子来表达这个东西。 p%k==1.会让我们想到NTT的w=power(g,(p-1)/k)。而w的性质就是w^i=1%p当且仅当i... Read More
posted @ 2015-04-02 18:19 ZYF-ZYF Views(481) Comments(0) Diggs(0) Edit
题目:http://www.lydsy.com/JudgeOnline/problem.php?id=2118题解:考虑模某个数意义下x是否能达到。用最小的数作为模数,那么只要建图跑最短路就可以统计答案了。代码: 1 #include 2 #include 3 #include 4 #include... Read More
posted @ 2015-04-02 16:24 ZYF-ZYF Views(802) Comments(2) Diggs(0) Edit