Cod sursa(job #915144)

Utilizator TibixbAndrei Tiberiu Tibixb Data 14 martie 2013 19:24:40
Problema Patrate2 Scor 90
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.54 kb
#include<fstream>
using namespace std;
int n, i, p, v[10000], t, j, aux;
int main(){
	ifstream f("patrate2.in");
	ofstream g("patrate2.out");
	f>>n;
	v[1]=1; v[0]=1;
	for(i=2; i<=n; i++){
		for(j=1; j<=v[0]; j++){
			aux=v[j]*i+t;
			v[j]=aux%10;
			t=aux/10;
		}
		while(t!=0){
			v[++v[0]]=t%10;
			t/=10;
		}
	}
	for(i=1; i<=n*n; i++){
		for(j=1; j<=v[0]; j++){
			aux=v[j]*2+t;
			v[j]=aux%10;
			t=aux/10;
		}
		while(t!=0){
			v[++v[0]]=t%10;
			t/=10;
		}
	}
	for(i=v[0]; i>=1; i--){
		g<<v[i];
	}
 return 0;
 }