Cod sursa(job #2900014)

Utilizator Tony2003Tony Tamas Tony2003 Data 9 mai 2022 21:30:33
Problema Cifra Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.4 kb
#include<fstream>
#include<cmath>

using namespace std;

ifstream fin("cifra.in");
ofstream fout("cifra.out");

long long int n, t, s = 0;

int main()
{
    fin >> t;
    
    for(int i = 1; i <= t; i++)
    {
        fin >> n;
        s = 0;
        for(int j = 1; j <= n; j++)
        {
            long long x = pow(j, j);
            s += x;
        }
        fout << s % 10 << endl;
    }

    return 0;
}