📄 374 big mod.cpp
字号:
#include<iostream>
#include<iomanip>
#include<cmath>
#define L unsigned long long int
L bigmod(L bb,L pp,L mm)
{
L temp;
if(pp==0)
return 1;
if(pp==1)
return bb;
if(pp%2!=0)
{
temp=bigmod(bb,(pp-1)/2,mm);
temp=(temp*temp)%mm;
temp=(temp*bb)%mm;
return temp;
}
else
{
temp=bigmod(bb,pp/2,mm);
temp=(temp*temp)%mm;
return temp;
}
}
using namespace std;
int main()
{
L b,p,m;
while(cin>>b>>p>>m)
{
L res=bigmod(b,p,m);
cout<<res<<endl;
}
system("pause");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -