快速幂
文章平均质量分 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 modulo 1000000007 (109 + 7). Input The first line contains two int原创 2017-10-29 09:00:22 · 223 阅读 · 0 评论 -
矩阵 快速幂
1. 快速幂 O(logn) #include #include using 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 · 146 阅读 · 0 评论 -
hdu 6395 Sequence 分块+矩阵快速幂
Problem Description Let 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. Input The first li...原创 2018-08-17 15:02:21 · 172 阅读 · 0 评论