快速幂
Dreamlandzxx
这个作者很懒,什么都没留下…
展开
-
快速幂取余和矩阵快速幂
下面是 m^n % k 的快速幂: // m^n % k int quickpow(int m,int n,int k) { int b = 1; while (n > 0) { if (n & 1) b = (b*m)%k; n = n >> 1 ; m = (转载 2016-11-17 21:57:37 · 453 阅读 · 0 评论 -
nyoj 148 fibonacci数列(二)(矩阵快速幂)
fibonacci数列(二) 时间限制:1000 ms | 内存限制:65535 KB 难度:3 描述 In the Fibonacci integer sequence, F0 = 0, F1 = 1, and Fn = Fn − 1 + Fn − 2 for n ≥ 2. For example, the first ten terms of the F原创 2016-12-01 08:59:50 · 294 阅读 · 0 评论 -
HDOJ 1757 A Simple Math Problem
A Simple Math Problem Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 4334 Accepted Submission(s): 2605 Problem Description Lele原创 2016-12-01 09:05:03 · 282 阅读 · 0 评论