Pagini recente » Cod sursa (job #439155) | Cod sursa (job #966480) | Monitorul de evaluare | Cod sursa (job #405034) | Cod sursa (job #392765)
Cod sursa(job #392765)
#include<fstream>
using namespace std;
unsigned long power(int x,int n)
{
if(n == 0)return 1;
else if(n%2 != 0) return x*(power(x,(n-1)/2)*power(x,(n-1)/2));
else return (power(x,n/2)*power(x,n/2));
}
const long a = 1999999973;
int main()
{
ifstream fin("lgput.in");
ofstream fout("lgput.out");
unsigned long x,n;
fin>>x>>n;
fout<<power(x,n)%a;
fin.close();
fout.close();
return 0;
}