Cod sursa(job #1781627)
| Utilizator | Data | 17 octombrie 2016 09:34:28 | |
|---|---|---|---|
| Problema | Patrate2 | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.67 kb |
#include <bits/stdc++.h>
using namespace std;
int n, a[100007], lung;
void Produs(int x)
{
int i, tr=0, aux;
for (i=1; i<=lung; i++)
{
aux=a[i]*x+tr;
tr=aux/10;
a[i]=aux%10;
}
while (tr>0)
{
a[++lung]=tr%10;
tr/=10;
}
}
int main()
{
int i;
ifstream fin ("patrate2.in");
fin >> n;
fin.close();
a[1]=lung=1;
for (i=1; i<=n; i++)
Produs(i);
n=n*n;
for (i=1; i<=n; i++)
Produs(2);
ofstream fout ("patrate2.out");
for (i=lung; i>0; i--)
fout << a[i];
fout << "\n";
fout.close();
return 0;
}
