51nod 1004 n^n的末位数字(快速幂)
来源:互联网 发布:java后端工程师 编辑:程序博客网 时间:2024/06/06 05:50
51nod 1004 n^n的末位数字
末尾,快速幂mod10即可。
#include <iostream>#include <cstdio>#include <cstring>#include <cmath>#include <algorithm>#include <queue>#include <map>using namespace std;#define LL long long#define INF 0x3f3f3f3f#define PI acos(-1.0)#define E 2.71828#define MOD 1000000007#define N 1010LL quick_mi(LL x,LL n){ LL ans = 1; while(n) { if(n&1) ans = (ans*x)%10; x = (x*x)%10; n >>= 1; } return ans;}int main(){ LL n; scanf("%lld",&n); LL ans =quick_mi(n,n); printf("%lld\n",ans); return 0;}
0 0
- 51nod 1004 n^n的末位数字(快速幂)
- 51Nod 1004 n^n的末位数字()
- 51Nod-1004 n^n的末位数字【快速模幂】
- 51Nod 1004 n^n的末位数字(快速幂)
- 1004 n^n的末位数字(快速幂)
- 1004 n^n的末位数字 (快速幂)
- 51nod 1004 n^n的末位数字
- 51nod-【1004 n^n的末位数字】
- 51nod 1004 n^n的末位数字
- 51nod 1004 n^n的末位数字
- 51NOD 1004 n^n的末位数字
- [51NOD] 1004 n^n的末位数字 [数学]
- 51nod 1004 n^n的末位数字
- 51Nod 1004 n^n的末位数字
- 【51Nod】1004 n^n的末位数字
- 51Nod--1004 n^n的末位数字
- 51nod 1004 n^n的末位数字
- 51nod 1004 n^n的末位数字
- Android开发之AutoCompleteTextView
- 走进江城武汉,调查公民环境生态意识
- 233_自定义一个百分比占比沙漏型的圆
- 公民环保意识知多少 调查江城武汉公民环保意识
- 【bzoj 2102】 [HNOI2005]狡猾的商人 带权并查集维护区间和
- 51nod 1004 n^n的末位数字(快速幂)
- 以非gradle方式将 Eclipse 项目导入Android Studio
- 234_自定义一个百分比例的环形饼状图
- 操作系统调度方法
- Quick-cocos2d-x游戏数据存储
- 读取不同格式文件的两种方式
- java编程思想 第四版 第七章读书笔记
- 235_自定义抽签器一
- (kuangbin DFS)棋盘问题