Pagini recente » Diferente pentru problema/posta intre reviziile 10 si 6 | Cod sursa (job #744704) | Cod sursa (job #1030902) | Cod sursa (job #2007270) | Cod sursa (job #2397830)
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
int f(int 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,p/2)*f(n,p/2);
}
else
{
return f(n,p/2)*f(n,(p/2)+1);
}
}
int main()
{int n,p;
fin>>n>>p;
fout<<f(n,p);
}