0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-09-21 13:25:24 +00:00
OI-codes/LibreOJ/10194/data/1.cpp

18 lines
306 B
C++
Raw Normal View History

2022-05-28 12:25:28 +00:00
#include<cstdio>
using namespace std;
int a,b,m;
int Ksm(int x,int d)
{
int res=1;
for (; d; d/=2,x=1ll*x*x%m)
if (d%2) res=1ll*res*x%m;
return res;
}
int main()
{
freopen("data10.in","r",stdin);
freopen("data10.out","w",stdout);
scanf("%d%d%d",&a,&b,&m);
printf("%d",Ksm(a,b));
}