代码
查看原帖
代码
1390858
wzy8891楼主2025/1/18 17:45
#include<bits/stdc++.h>
using namespace std;
#define int long long
int a,b,c;
signed main(){
	cin>>a>>b>>c;
	int e=1;
	cout<<a<<"^"<<b<<" mod "<<c<<"=";
    while(b>0){
    	if(b%2==1) e=(e*a)%c;
    	a=(a*a)%c;
    	b/=2;
	}
	cout<<e;
	return 0;
} 
2025/1/18 17:45
加载中...