摘要:
将gg(n)视为一个未知元,先由1000000007找出循环节222222224,然后再找出g(n)为变量时的循环节183120,然后应用矩阵快速幂求解即可。代码如下:#include<iostream>#include<cstdio>#include<cstdlib>#include<algorithm>#include<cmath>#include<queue>#include<set>#include<map>#include<cstring>#include<vector& 阅读全文
摘要:
通过离线处理,由于线段树不能够动态的扩张,将所有的数都进行永久标号,无视信息的冗余。对于每一个节点,保留对5取余的所有余数的和值,用long long存储。然后根据元素个数进行更新。代码如下:#include<iostream>#include<cstdio>#include<cstdlib>#include<algorithm>#include<cmath>#include<queue>#include<set>#include<map>#include<cstring>#includ 阅读全文