Submission #11217971


Source Code Expand

Copy
#include<iostream>
using namespace std;
long long fun(long long n,long long p,long long m)
{
long long t;
if(p==1)
return n%m;
else
{
if(p%2==1)
{
t=fun(n,p/2,m);
return ((t%m)*(t%m)%m*(n%m))%m;
}
else
{ t=fun(n,p/2,m);
return((t%m)*(t%m))%m;
}
}
}
int main()
{ long long n,m,p,t;
cin>>n>>m>>p;
t=fun(n,p,m);
cout<<t<<endl;
return 0;
}

Submission Info

Submission Time
Task B - n^p mod m
User luogu_bot1
Language C++ (GCC 5.4.1)
Score 0
Code Size 365 Byte
Status

Compile Error

./Main.cpp:13:1: error: stray ‘\357’ in program
 return ((t%m)*(t%m)%m*(n%m))%m;
 ^
./Main.cpp:13:1: error: stray ‘\274’ in program
./Main.cpp:13:1: error: stray ‘\233’ in program
./Main.cpp: In function ‘long long int fun(long long int, long long int, long long int)’:
./Main.cpp:14:1: error: expected ‘;’ before ‘}’ token
 }
 ^