Cod sursa(job #2613855)
| Utilizator | Data | 10 mai 2020 19:14:48 | |
|---|---|---|---|
| Problema | Cifra | Scor | 0 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.39 kb |
#include <cmath>
#include <fstream>
using namespace std;
int main() {
ifstream fin("cifra.in");
ofstream fout("cifra.out");
unsigned T;
fin >> T;
for (unsigned i = 0; i < T; i++) {
unsigned N;
fin >> N;
unsigned result = 1;
for (unsigned j = 2; j <= N; j++)
result = (result + (unsigned long long)pow(j, j) % 10) % 10;
fout << result << endl;
}
return 0;
}
