Cod sursa(job #2663382)

Utilizator tibinyteCozma Tiberiu-Stefan tibinyte Data 26 octombrie 2020 11:13:08
Problema Patrate2 Scor 10
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.55 kb
#include <fstream>

using namespace std;
ifstream cin("patrate2.in");
ofstream cout("patrate2.out");
void ProdusMic(int x[10001], int n)
{
  int i,t=0;
  for(i=1;i<=x[0];i++,t/=10)
  {
    t+=x[i]*n;
    x[i]=t%10;
  }
  for(;t;t/=10)
    x[++x[0]]=t%10;
}
int main()
{
    int n;
    cin>>n;
    int x[10001] = {1 , 1};
    if(n==1){
        cout<<2;
    }
    else{
        for(int i = 0 ; i < n*n+1 ; ++i){
            ProdusMic(x , 2);
        }
        for(int i = x[0] ; i>= 1 ; --i){
            cout<<x[i];
        }
    }
}