#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
using namespace std; int pow(int x, int n)
{
int result = 1;
while (n > 0)
{
if (n % 2==1)
result *= x;
x *= x;
n /=2 ;
}
return result;
} int main()
{
int n,m;
while(~scanf("%d%d",&n,&m))
{
int s = pow(n,m);
printf("%d\n",s);
}
return 0;
}
相关文章
- BZOJ 2242 [SDOI2011]计算器 BSGS+高速幂+EXGCD
- 牛客周赛 Round 20 解题报告 | 珂学家 | 状压DP/矩阵幂优化 + 前缀和的前缀和-整体评价
- 求幂pow()
- Codeforces Round #307 (Div. 2) D. GukiZ and Binary Operations 矩阵快速幂优化dp
- poj 2778 AC自己主动机 + 矩阵高速幂
- bzoj 3240: [Noi2013]矩阵游戏 矩阵乘法+十进制快速幂+常数优化
- HDOJ 4549 M斐波那契数列 费马小定理+矩阵高速幂
- HDU 小明系列故事——师兄帮帮忙 高速幂
- HDU - 1588 Gauss Fibonacci (矩阵高速幂+二分求等比数列和)
- HDU 3461 Code Lock(并查集的应用+高速幂)