摘要:
#include #include #include #include #include #include using namespace std; typedef long long LL; const int maxn=1000007; const int INF=0x3f3f3f3f; const int mod=1000003; LL a[maxn], vis[maxn],... 阅读全文
posted @ 2016-08-11 10:54
爱记录一切美好的微笑
阅读(144)
评论(0)
推荐(0)
摘要:
快速幂取模 用法:用于求解 a 的 b 次方,而b是一个非常大的数,用O(n)的复杂度会超时。那么就需要这个算法,注意它不但可以对数求次幂,而且可用于矩阵快速幂。 假如求 x ^ n 次方 我们可以把 n 表示为 2^k1 + 2k2 + 2^k3....,可以证明所有数都可以用前式来表示。(其实就 阅读全文
posted @ 2016-08-11 09:58
爱记录一切美好的微笑
阅读(131)
评论(0)
推荐(0)