三个TLE
查看原帖
三个TLE
1227585
liyihe楼主2024/11/25 21:15
#include<bits/stdc++.h>
using namespace std;
int count(int a,int b,int flag,int p){
	if(b==0){
		return flag;
	}
	flag*=a%p;
	flag%=p;
	return count(a,b-1,flag,p);
}
int main(){
    int a,b,p;
    cin>>a>>b>>p;
    cout<<a<<"^"<<b<<" mod "<<p<<"="<<count(a,b,1,p);
    return 0;
}

求调

2024/11/25 21:15
加载中...