Pagini recente » Cod sursa (job #1612296) | Cod sursa (job #458635) | Cod sursa (job #1148644) | Cod sursa (job #195654) | Cod sursa (job #1001123)
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
int weird = 1999999973;
int powLog(int n, int p);
int main()
{
int n,p;
fin>>n;
fin>>p;
fout << powLog(n,p)% weird;
return 0;
}
int powLog(int n, int p)
{
if(p==0) return 1;
else if(p==1) return n;
else if(p%2==0) return powLog(n*n,p/2);
else return n*powLog(n*n,(p-1)/2);
}