#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 10;
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;
int t, n, m, a[maxn], cnt;
char s[maxn], s2[maxn];
ll FastPower(int n, int k) {
ll ans = 1;
//n %= mod;
while(k) {
if(k % 2) {
ans *= n;
// ans = (ans * k) % mod;
}
k >>= 1;
n *= n;
// k = (k * k) % mod;
}
return ans;
}
int main() {
ios::sync_with_stdio(false);
cin >> n >> m;
cout << FastPower(n, m) << endl;
}
快速幂
最新推荐文章于 2025-04-13 23:00:00 发布