Cod sursa(job #1521177)
Utilizator | Data | 9 noiembrie 2015 23:22:01 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.39 kb |
#include <iostream>
#include <fstream>
#include <cmath>
using namespace std;
int main ()
{
int i, j; char a[30000];
ifstream f("fact.in");
ofstream g("fact.out");
f >> t;
for (j = 1; j <= t; j++) {
f >> a[j]; n = (int) a[j];
int s = 0;
for (i = 1; i <= n; i++)
s += pow(i,i);
g << s % 10 << endl;
}
f.close ();
g.close ();
return 0;
}