Cod sursa(job #2033904)

Utilizator popovicimariaginaPopovici Maria Gina popovicimariagina Data 7 octombrie 2017 11:47:01
Problema Fractal Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.52 kb
#include <fstream>
#include <math.h>
using namespace std;

ifstream f("fractal.in");
ofstream g("fractal.out");
int k, x, y;


int main()
{
    f>>k>>x>>y;
    if(x==1 && y == 1)
        g<<0;
    else
    {
        if(x < pow(2, k-1))
        {
            if(y < pow(2,k-1))
                g<<pow(2, k);
            else g<<pow(2, k)+1;
        }
        else
        {
            if(y < pow(2,k-1))
                g<<2*pow(2, k)+1;
            else g<<3*pow(2, k)+1;
        }
    }
    return 0;
}