Cod sursa(job #2293804)

Utilizator PopescuAndreiAlexandruPopescu Andrei Alexandru PopescuAndreiAlexandru Data 1 decembrie 2018 16:37:41
Problema Cifra Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.39 kb
#include <iostream>
#include <fstream>
#include <cmath>

using namespace std;

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

long long n,P=0,i,k,uc,S,T,j;

int main()
{
    fin>>n;
    S=0;
    for(i=1;i<=n;i++)
    {
        fin>>T;
        for(j=1;j<=T;j++)
        {
            S=S+pow(j,j);
        }
        uc=S%10;
        fout<<uc<<endl;
        S=0;
    }
}