Submission #10776813
Source Code Expand
#include<bits/stdc++.h> using namespace std; typedef long long ll; ll n,p,m; ll pw(ll n,ll p,ll m){return p==1?n%m:(pw(n*n%m,p/2)*(p&1?n:1)%m);} //pw(n,p,m)=n^p mod m int main(){ ios::sync_with_stdio(false); cin>>n>>m>>p; cout<<pw(n,p,m)<<endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - n^p mod m |
User | luogu_bot5 |
Language | C++ (GCC 5.4.1) |
Score | 0 |
Code Size | 272 Byte |
Status | CE |
Compile Error
./Main.cpp: In function ‘ll pw(ll, ll, ll)’: ./Main.cpp:5:52: error: too few arguments to function ‘ll pw(ll, ll, ll)’ ll pw(ll n,ll p,ll m){return p==1?n%m:(pw(n*n%m,p/2)*(p&1?n:1)%m);} ^ ./Main.cpp:5:4: note: declared here ll pw(ll n,ll p,ll m){return p==1?n%m:(pw(n*n%m,p/2)*(p&1?n:1)%m);} ^