Cod sursa(job #1507866)

Utilizator MickeyTurcu Gabriel Mickey Data 21 octombrie 2015 23:01:26
Problema Cifra Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.4 kb
#include<stdio.h>
#include<iostream>
#include<fstream>
using namespace std;
int t, n, cif,i,j;
ifstream f("cifra.in");
ofstream g("cifra.out");
int main() {

	while (f >> t)
	{
		for (i = 1; i <= t; i++)
		{
			n = i;
			for (j = 1; j <= i; j++)
				n = n*n;
				
			cif = cif + n;
				while (cif > 9)
					cif = cif / 10;
		}
		g << cif;


	}
		
	system("pause");
	return 0;
}