Cod sursa(job #2980900)
Utilizator | Data | 16 februarie 2023 21:48:22 | |
---|---|---|---|
Problema | Patrate2 | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.61 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream f("patrate2.in");
ofstream g("patrate2.out");
int h[100000];
void produs(int *h, int x) {
int i, T = 0;
for (i = 1; i <= h[0]; i++) {
h[i] = h[i] * x + T;
T = h[i] / 10;
h[i] = h[i] % 10;
}
while (T) {
h[++h[0]] = T % 10;
T /= 10;
}
}
int main(){
int n;
f >> n;
h[0] = h[1] = 1;
for(int i = 2; i <= n; ++i) produs(h, i);
for(int i = 1; i <= n * n; ++i) produs(h, 2);
for(int i = h[0];i >= 1; --i) g << h[i];
f.close();
g.close();
return 0;
}