Cod sursa(job #2541583)

Utilizator Alexandru_CSMConstantinescu Alexandru Alexandru_CSM Data 8 februarie 2020 16:58:33
Problema Cifra Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.56 kb
#include <bits/stdc++.h>
#include <math.h>
#include <fstream>
using namespace std;

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

typedef long long int lint;
int v[30005];
int main()
{
    int n;
    fin>>n;
    for(int i = 1; i <= n; i++)
    {
        fin>>v[i];
    }
    for(int i = 1; i <= n; i++)
    {
        int sum = 0;
        for(int j = 1; j <= v[i]; j++)
        {
            int poww = pow(j, j);
            sum += poww;
        }
        fout<<sum%10<<endl;
    }
    fin.close();
    fout.close();
    return 0;
}