
快速幂
hjq_xidian
这个作者很懒,什么都没留下…
展开
-
HDU 1061
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1061一上来先无脑每次乘完用10取余,提交了一遍,果然超时。然后分析发现各个数的周期是1、2、4 然后乱搞了一下居然过了!!! 不过把1024换成更小就会wa#include<iostream> using namespace std; int main() { long long n,m,i原创 2016-09-27 23:41:57 · 370 阅读 · 0 评论 -
HDU2035
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2035又是一道快速幂。。。#include<iostream>int qp(int a,int b) { int t=a%1000,s=1; while(b) { if(b & 1) s=s*t%1000; t=t*t%100原创 2016-09-28 20:27:52 · 223 阅读 · 0 评论