Cod sursa(job #2267545)
Utilizator | Data | 23 octombrie 2018 19:08:39 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.37 kb |
#include<fstream>
#include<string>
#include<math.h>
std::ifstream fin("cifra.in");
std::ofstream fout("cifra.out");
int main() {
int t,i;
fin >> t;
std::string nr;
long nr2, suma;
for (i = 1; i <= t; i++)
{
fin >> nr;
suma = 0;
for (int j = 1; j <= std::stoi(nr); j++) {
suma += pow(j, j);
}
fout << suma % 10<<"\n";
}
system("pause");
}