Pagini recente » Cod sursa (job #3271477) | Cod sursa (job #2502757) | Cod sursa (job #1191966) | Cod sursa (job #544459) | Cod sursa (job #2671017)
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("lgput.in");
ofstream g("lgput.out");
const long m=1999999973;
int puteri(int x, int n)
{
if(n==0)
{
return 1;
}
else if(n==1)
{
return x;
}
else if(n%2==0)
{
return puteri((x*x)%m, n/2);
}
else if(n%2==1)
{
return (x%m)*puteri((x*x)%m, (n-1)/2);
}
}
int main()
{
int n, x;
f>>x>>n;
g<<puteri(x, n);
return 0;
}