Pagini recente » Cod sursa (job #2626752) | Cod sursa (job #942096) | Cod sursa (job #3151961) | Cod sursa (job #2514771) | Cod sursa (job #2343736)
#include <fstream>
using namespace std;
ifstream fin("fractal.in");
ofstream fout("fractal.out");
int n,x,y,l,i;
int main()
{
fin>>l>>y>>x;
int nr=0;
l=1<<l;
while(x>1||y>1)
{
l=l/2;
if(x<=l&&y<=l)
swap(x,y);
else
if(x>l&&y<=l)
{
nr=nr+l*l;
x=x-l;
}
else
if(x>l&&y>l){
nr=nr+2*l*l;
x-=l;y-=l;
}
else
{
nr=nr+3*l*l;
y=y-l;
//x=l-x+1;
//swap(x,y);
}
}
fout<<nr;
return 0;
}