📄 1420 prepared for new acmer.cpp
字号:
/*
1420 Prepared for New Acmer
Time Limit : 1000 ms Memory Limit : 32768 K Output Limit : 256 K
GUN C++
*/
#include <iostream>
using namespace std;
const int Max=1000000;
int main()
{
int t,a,b,c,i;
long long temp,an;
cin>>t;
while(t--)
{
cin>>a>>b>>c;
a=a%c;
temp=1;an=a;
while(b>1)
{
if(b%2==1)
{ temp*=an;temp%=c;b--;}
else
{
an*=an;
an%=c;
b/=2;
}
}
cout<<(an*temp)%c<<endl;
}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -