Cod sursa(job #1604601)
Utilizator | Data | 18 februarie 2016 13:45:04 | |
---|---|---|---|
Problema | Patrate2 | Scor | 0 |
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+1);
g.close();
f.close();
}