快速幂
文章平均质量分 72
live4m
老菜逼了
展开
-
2018焦作网络赛 G.Give Candies (找规律+十进制快速幂)
G.Give CandiesThere are N children in kindergarten. Miss Li bought them N candies. To make the process more interesting, Miss Li comes up with the rule: All the children line up according to their st...原创 2019-10-16 18:53:23 · 206 阅读 · 0 评论 -
NBUT1675 a^b (快速幂+快速乘)
问题描述求a的b次方,取模mod(1<=a,b,mod<=1e18)Input多组输入,每组数据一行,3个正整数,分别为a,b,modOutput每组数据输出一行,为答案Sample Input2 10 100000005 100 10 2 37Sample Output102400分析:乍一眼看上去就是个快速幂裸题,没想到因为数据范围太大long lon...原创 2019-05-30 20:56:30 · 224 阅读 · 0 评论 -
矩阵快速幂
题意:求斐波那契数列的第n项 f[n] 膜10000 也就是f[n]%10000但是0 ≤ n ≤ 1,000,000,000给了一个式子:分析:用矩阵快速幂图中三个1的矩阵A的n-1次幂,第一行第一列的数字就是答案。(记得取模)下面是板子和ac代码ps:以前以为矩阵快速幂很难,现在发现和普通快速幂基本一样抄来的矩阵快速幂板子:const int maxm=1e3+5...原创 2019-06-12 20:02:48 · 247 阅读 · 0 评论 -
十进制倍增快速幂
底数十进制倍增原理:2435=2400+230+25=(2100)4+(210)3+(21)5例题:P5091#include<iostream>#include<cstdio>#include<cstring>#include<cmath>#include<queue>#include<algorithm>...原创 2019-08-05 14:48:58 · 212 阅读 · 0 评论 -
hdu6030 Happy Necklace (推导+矩阵快速幂)
问题描述小Q想给他的女朋友买一条项链。项链是由红色和蓝色的珠子组成的单串项链。小Q拼命想给女朋友留下好印象,他知道她一定会喜欢这条项链的,只要对项链中每一个素数的连续子序列,红珠子的数量不小于蓝珠子的数量。现在小Q想买一条正好有n颗珠子的项链。他想知道有多少种不同的项链能让他的女朋友开心。请编写一个程序来帮助小q。由于答案可能非常大,请打印出模109+7的答案。注意:项链是单串的,不是圆的...原创 2019-08-09 23:21:28 · 142 阅读 · 0 评论 -
hdu6736 Forest Program (推导+求环的边数+快速幂)
Problem DescriptionThe kingdom of Z is fighting against desertification these years since there are plenty of deserts in its wide and huge territory. The deserts are too arid to have rainfall or huma...原创 2019-10-12 22:52:23 · 890 阅读 · 1 评论