Pagini recente » Cod sursa (job #1798176) | Rating FIICernatHurjuiSchipor (FIICHS) | Cod sursa (job #1284243) | Cod sursa (job #1270438) | Cod sursa (job #936575)
Cod sursa(job #936575)
#include<iostream>
#include<fstream>
using namespace std;
int n,p;
int pow ( int a, int b )
{
if(b==1) return a%1999999973;
if(b%2==0)
{
int r;
r= pow(a,b/2)%1999999973;
return r*r%1999999973;
}
else
{
int r;
r= pow(a,b/2)%1999999973;
return r*r*a%1999999973;
}
}
int main()
{
ifstream f("lgput.in");
ofstream g("lgput.out");
f>>n>>p;
if(p==0)
g<<1;
else
g<<pow(n,p);
return 0;
}