Cod sursa(job #3174203)

Utilizator spookie_cookieDianaIf spookie_cookie Data 24 noiembrie 2023 13:26:43
Problema Cifra Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.33 kb
#include <iostream>
#include <fstream>
#include <cmath>
std::ifstream f("cifra.in");
std::ofstream g("cifra.out");

int main()
{
	int n, m;
	f >> n;
	for (int i = 1; i <= n; i++)
	{
		f >> m;
		int rez = 0;
		for (int j = 1; j <= m; j++)
		{
			rez = rez + pow(j, j);
		}
		g << rez%10 <<std::endl;
	}
	return 0;

}