Cod sursa(job #2051870)

Utilizator dumandgaDumitra Andrei 322CC dumandga Data 29 octombrie 2017 17:26:47
Problema Cifra Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.34 kb
#include<fstream>
#include<math.h>
using namespace std;
int main()
{
	ifstream f;
	f.open("cifra.in");
	ofstream g;
	g.open("cifra.out");

	int t;
	f >> t;
	while (t != 0)
	{
		int n;
		f >> n;
		int s = 0;
		for (int i = 1; i <= n; i++)
		{
			s = s + pow(i, i);
		}
		t--;
		g << s % 10 << endl;
	}
	f.close();
	g.close();
}