Submission #10093972


Source Code Expand

using namespace std;
#define ll long long
#define re register
inline ll read()
{
	char c=getchar();int f=1,s=0;
	while(!isdigit(c)){f=-1;c=getchar();}
	while(isdigit(c)){s=s*10+c-48;c=getchar();}
	return s;
}
const double pi=acos(-1.0);
signed main()
{
	ll n,m,p,ans=1;
	cin>>n>>m>>p;
	for(;p;p>>=1,n*n%m)
	{
		if(p&1) ans=ans*n%m;
	}
	cout<<ans<<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 389 Byte
Status CE

Compile Error

./Main.cpp: In function ‘long long int read()’:
./Main.cpp:6:17: error: ‘getchar’ was not declared in this scope
  char c=getchar();int f=1,s=0;
                 ^
./Main.cpp:7:18: error: ‘isdigit’ was not declared in this scope
  while(!isdigit(c)){f=-1;c=getchar();}
                  ^
./Main.cpp:8:17: error: ‘isdigit’ was not declared in this scope
  while(isdigit(c)){s=s*10+c-48;c=getchar();}
                 ^
./Main.cpp: At global scope:
./Main.cpp:11:26: error: ‘acos’ was not declared in this scope
 const double pi=acos(-1.0);
                          ^
./Main.cpp: In function ‘int main()’:
./Main.cpp:15:2: error: ‘cin’ was not declared in this scope
  cin>>n>>m>>p;
  ^
./Main.cpp:20:2: error: ‘cout’ was not declared in this scope
  cout<<ans<<endl;
  ^
./Main.cpp:20:13: error: ‘endl’ was not declared in this scope
  cout<<ans<<endl;
             ^