Cod sursa(job #1604826)

Utilizator gorni97aaa aaa gorni97 Data 18 februarie 2016 16:55:09
Problema Patrate2 Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.34 kb
#include <iostream>
#include <fstream>


int pow(int x,int y)
{int p=1;

while(y>0)
{
    if(y%2==0)
{x=x*x;
y=y/2;
}
else
{
    p=p*x;
    y--;
}
}
    return p;
}

using namespace std;
int main()

{
    int n;
    fstream f("patrate2.in",ios::in);
    fstream g("patrate2.out",ios::out);
    f>>n;
g<<pow(2,n*n)*n;
}