Pagini recente » Cod sursa (job #436071) | Cod sursa (job #2399971) | Cod sursa (job #2240565) | Cod sursa (job #936577)
Cod sursa(job #936577)
#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;
}