
快速幂 | 矩阵快速幂
YOONGI
这个作者很懒,什么都没留下…
展开
-
快速幂模板
模板1: int power(int a,int b,int c) { int ans=1; a=a%c; while(b) { if(b%2==1) ans=ans*a%c; a=a*a%c; b/2; } return ans; } 模板2: #define ll...原创 2019-03-18 16:43:59 · 82 阅读 · 0 评论 -
HDU-6470 Count(矩阵快速幂)
Count Time Limit: 6000/3000 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 435Accepted Submission(s): 177 Problem Description Farmer John有n头奶牛. 某天奶牛想要数一数有多...原创 2019-03-18 18:45:15 · 267 阅读 · 0 评论 -
HDU - 3117 Fibonacci Numbers (矩阵快速幂 + 斐波那契通项公式)
Fibonacci Numbers 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3117 The Fibonacci sequence is the sequence of numbers such that every element is equal to the sum of the two previous elements, exc...原创 2019-04-08 20:31:05 · 501 阅读 · 0 评论 -
HDU - 6030 Happy Necklace (规律+矩阵快速幂)
Happy Necklace Little Q wants to buy a necklace for his girlfriend. Necklaces are single strings composed of multiple red and blue beads. Little Q desperately wants to impress his girlfriend, he kno...原创 2019-05-21 09:43:09 · 226 阅读 · 0 评论 -
牛客小白月赛14 B投硬币(组合数)
链接:https://ac.nowcoder.com/acm/contest/879/B 来源:牛客网 你在练习 dp,你每一次会有 p 的概率成功,1-p 的概率失败 求投 n 次后,至少有 k 次成功的概率 答案模 998244353,其中 0≤k,n≤105,0≤p<9982443530≤k,n≤105,0≤p<998244353 实际上给你的这个概率是在模 9982443...原创 2019-05-13 10:56:24 · 218 阅读 · 0 评论