![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
快速幂
文章平均质量分 86
liluoyu_1016
这个作者很懒,什么都没留下…
展开
-
Jzzhu and Sequences CodeForces - 450B 矩阵快速幂
Jzzhu has invented a kind of sequences, they meet the following property:You are given x and y, please calculate fn modulo1000000007 (109 + 7).Input The first line contains two int原创 2017-10-29 09:00:22 · 232 阅读 · 0 评论 -
矩阵 快速幂
1. 快速幂 O(logn)#include#includeusing namespace std;typedef long long ll;ll mod_pow(ll x,ll n){ ll ret=1; while(n>0) { if(n&1) ret=ret*x; x=x*x; n>原创 2017-08-09 11:24:52 · 154 阅读 · 0 评论 -
hdu 6395 Sequence 分块+矩阵快速幂
Problem DescriptionLet us define a sequence as below ⎧⎩⎨⎪⎪⎪⎪⎪⎪F1F2Fn===ABC⋅Fn−2+D⋅Fn−1+⌊Pn⌋ Your job is simple, for each task, you should output Fn module 109+7. InputThe first li...原创 2018-08-17 15:02:21 · 195 阅读 · 0 评论