文章
71
粉丝
142
获赞
5
访问
52.4k
#include<iostream>
#include<cstring>
using namespace std;
int fast(int a,int b,int mod) {
long long answer = 1;
a=a%mod;
while (b!=0) {
if (b%2==1) {
answer = answer * a;
answer = answer % mod;
}
b /= 2;
a = a * a;
a = a % mod;
}
return answer;
}
int main() {
int a, b;
cin>>a>>b;
int sum=fast(a,b, 233333);
cout << sum << endl;
return 0;
}
登录后发布评论
注意乘法溢出的问题,不能用int,用long long