Cod sursa(job #3250912)

Utilizator cristian46290Petre Cristian cristian46290 Data 24 octombrie 2024 09:40:09
Problema Patrate2 Scor 100
Compilator cpp-64 Status done
Runda cex_1 Marime 0.63 kb
#include <iostream>
#include <fstream>
#include <queue>

using namespace std;

ifstream f("patrate2.in");
ofstream g("patrate2.out");

const int nMax = 10005;

int n, a[nMax];

void produs(int a[],int x)
{
    int t = 0;
    for (int i = 1;i <= a[0];i++,t/=10){
        t += a[i] * x;
        a[i] = t % 10;
    }
    if (t != 0){
        for (;t != 0;t /= 10)a[++a[0]] = t % 10;
    }
}

int main()
{
    f >> n;
    a[0] = 1;
    a[1] = 1;
    for (int i = 1;i <= n;i++){
        produs(a,i);
    }
    for (int i = 1;i <= n * n;i++){
        produs(a,2);
    }
    for (int i = a[0];i >= 1;i--)g << a[i];
}