Pagini recente » Cod sursa (job #1063509) | Cod sursa (job #2798416) | Cod sursa (job #770900) | Cod sursa (job #330401) | Cod sursa (job #2397834)
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
int f(long long n,int p)
{if(n==0)
{
return 0;
}
if(p==1)
{
return 2;
}
if(p==0)
{
return 1;
}
if(p%2==0)
{
return f(n%1999999973,p/2)*f(n%1999999973,p/2);
}
else
{
return f(n%1999999973,p/2)*f(n%1999999973,(p/2)+1);
}
}
int main()
{int n,p;
fin>>n>>p;
fout<<f(n,p);
}