Pagini recente » Cod sursa (job #2636613) | Cod sursa (job #214430) | Monitorul de evaluare | Cod sursa (job #1377745) | Cod sursa (job #2045926)
#include <fstream>
#include <iostream>
using namespace std;
ifstream in("modulo.in");
ofstream out("modulo.out");
#define MAX 1999999973
long power(long x,long power,long c)
{
long res = 1;
while(power > 0)
{
if(power & 1)
res = (res*x)%c;
power = power >> 1;
x = (x*x) % c;
}
return res;
}
int main()
{
long a,b,c;
in >> a >> b >> c;
out << power(a,b,c);
return 0;
}