Submission #6949960


Source Code Expand

#include<bits/stdc++.h>
using namespace std;
long long b,p,k;
long long fast2(int a,int n,long long p)//法2 
{
	int s=1%p;
	while(n>0)
	{
		if(n&1) s=(s*a)%p;
		a=(a*a)%p;
		n>>=1;
	}
	return s;
}
int main()
{
	cin>>b>>k>>p;
	long long ans=fast1(b,p,k);
	cout<<b<<"^"<<k<<" mod "<<p<<"="<<ans<<endl;
	return 0;
}

Submission Info

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

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:18:27: error: ‘fast1’ was not declared in this scope
  long long ans=fast1(b,p,k);
                           ^