#include <iostream>
using namespace std;
typedef long long ll;
ll a,b,p;
ll q_pow(){
ll res=1,x=a;
while (b){
if (b&1) res=res*x%p;
x=x*x%p;
b>>=1;
}
}
int main (){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> a >> b >> p;
cout << q_pow();
return 0;
}
#include <iostream>
using namespace std;
typedef long long ll;
ll a,b,p;
ll q_pow(){
ll res=1,x=a%p;
while (b){
if (b&1) res=(res*(a%p))%p;
x=x*x%p;
b>>=1;
}
}
int main (){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> a >> b >> p;
cout << q_pow();
return 0;
}
#include <iostream>
using namespace std;
typedef long long ll;
ll a,b,p;
ll q_pow(){
ll res=1,x=a%p;
while (b){
if (b&1) res=(res*(a%p))%p;
x=x*x%p;
b>>=1;
}
}
int main (){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> a >> b >> p;
ll ans=q_pow();
cout << a << "^" << b << ' ';
cout << "mod" << ' ';
cout << p << '=';
cout << ans;
return 0;
}
#include <iostream>
using namespace std;
typedef long long ll;
ll a,b,p;
ll q_pow(){
ll res=1,x=a%p;
while (b){
if (b&1) res=(res*(a%p))%p;
x=x*x%p;
b>>=1;
}
return res;
}
int main (){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> a >> b >> p;
ll ans=q_pow();
cout << a << "^" << b << ' ';
cout << "mod" << ' ';
cout << p << '=';
cout << ans;
return 0;
}
#include <iostream>
using namespace std;
typedef long long ll;
ll a,b,p;
ll q_pow(ll a,ll b,ll p){
ll res=1,x=a%p;
while (b){
if (b&1) res=(res*(a%p))%p;
x=(x*x)%p;
b>>=1;
}
return res;
}
int main (){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> a >> b >> p;
cout << b << endl;
ll ans=q_pow(a,b,p);
cout << a << "^" << b << ' ';
cout << "mod" << ' ';
cout << p << '=';
cout << ans;
return 0;
}
#include <iostream>
using namespace std;
typedef long long ll;
ll a,b,p;
ll q_pow(){
ll res=1,x=a%p;
ll k=b;
while (k){
if (k&1) res=(res*(x%p))%p;
x=(x*x)%p;
k>>=1;
}
return res;
}
int main (){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> a >> b >> p;
ll ans=q_pow();
cout << a << "^" << b << ' ';
cout << "mod" << ' ';
cout << p << '=';
cout << ans;
return 0;
}
在WA一次我就真的要WA的一声就哭出来了
——违规紫衫