Cod sursa(job #1239475)
Utilizator | Data | 9 octombrie 2014 07:11:02 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.45 kb |
#include <iostream>
#include <fstream>
#include <cmath>
using namespace std;
int main()
{
ifstream in("cifra.in");
ofstream out("cifra.out");
unsigned int t, n, result = 0;
in >> t;
for(unsigned int k = 1; k <= t; k++){
in >> n;
for(unsigned int j = 1; j <= n; j++){
result = result + pow(j,j);
}
out << (result % 10) << endl;
result = 0;
}
return 0;
}