Cod sursa(job #1388605)
| Utilizator | Data | 15 martie 2015 16:24:34 | |
|---|---|---|---|
| Problema | Cifra | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.49 kb |
#include <iostream>
#include <fstream>
#include <cmath>
using namespace std;
ifstream fin("cifra.in");
ofstream fout("cifra.out");
int u(int n)
{
return n % 10;
}
int main()
{
int t;
long long int result;
int n;
fin >> t;
for(int i = 1; i <= t; i++)
{
fin >> n;
result = 0;
for(int j = 1; j <= n; j++)
{
result += pow(j, j);
}
fout << u(result) << endl;
}
return 0;
}
