#include<iostream>
#define M 1024
using namespace std;
int fp(int a, int b)
{
long long ret = 1, pow = a;
while(b != 0)
{
if(b&1) ret = (ret * pow) % M;
pow = (pow * pow) % M;
b >>= 1;
}
return (int)ret;
}
int main()
{
int a, b, c;
cin >> a >> b;
c = fp(a, b);
cout << c << endl;
return 0;
}
快速幂
最新推荐文章于 2022-03-26 17:30:18 发布