Cod sursa(job #1810995)
Utilizator | Data | 20 noiembrie 2016 19:06:51 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.51 kb |
#include <iostream>
#include <fstream>
using namespace std;
int i, j, s, nr, x, k, z, y;
long long n;
int main() {
ifstream fin("cifra.in");
ofstream fout("cifra.out");
fin >> n;
for (i = 1; i <= n; i++)
{
fin >> x;
for (j = 1; j <= x; j++)
{
z = 1;
for(k = 1; k <= j; k++) z = z * j;
s = s + z;
}
fout << s%10 << "\n";
s = 0;
}
return 0;
}