快速幂
文章平均质量分 66
_OTTFF
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
CF_288B_PoloThePenguinAndHouses
Polo the Penguin and Houses time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLittle penguin Polo loves his home villa原创 2015-07-29 22:22:12 · 495 阅读 · 0 评论 -
HDU_1061_RightmostDigit
这个问题直接做应该会超时。乍一看应该是快速幂,但是其实并不用快速幂,因为问题只需要最后一位的结果。因此可以简单地列举出来。//这题目根本不需要快速幂//1 1//2 2 4 8 6 2//3 3 9 7 1 3//4 4 6 4//5 5 10 (但是n的n次方中不会出现10)//6 6//7 7 9 3 1 7//8 8 4 2 6 8//9 9 1 9//0 0#原创 2015-07-21 12:12:44 · 400 阅读 · 0 评论 -
POJ_1995_RaisingModuloNumbers
没什么特别的,简单的快速幂,照着output中公式写即可#include #includeusing namespace std;int qp(int nn,int n,int m) //nn的n次幂模m{ int r=1; while(n>0) { if(n&1) r=(r*nn)%m; n>>=1原创 2015-07-23 09:18:24 · 301 阅读 · 0 评论 -
UVA_10006_CarmichaelNumbers
求一个数是不是卡米切尔数。卡米切尔数。1.不是素数2.符合所有的2#include #include using namespace std;const int M=65000;int pri[M];long long qp(long long nn,int n,int m) //这个题目中答案不会超int但{ long long r=1; wh原创 2015-07-23 09:14:24 · 317 阅读 · 0 评论 -
CF_327C_MagicFive
Magic Fivetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere is a long plate s containing n digits. Iahub wants to原创 2015-07-29 22:40:28 · 396 阅读 · 0 评论
分享