Cod sursa(job #2900012)

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

using namespace std;

int n, t, s = 0;
char v[100];

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

    return 0;
}