为什么T了3个点,样例过了,求调
查看原帖
为什么T了3个点,样例过了,求调
1008399
cyyzc楼主2024/7/9 10:36
#include<bits/stdc++.h>
using namespace std;
long long a,b,p,ret=1;
int main(){
	cin>>a>>b>>p;
	for(int i=0;i<b;i++)
	{
		ret=ret*a;
		ret=ret%p;
	}
	cout<<a<<"^"<<b<<" mod "<<p<<"="<<ret; 
	return 0;
}

思路没有问题, 怎么优化

2024/7/9 10:36
加载中...