Cod sursa(job #1521178)
Utilizator | Data | 9 noiembrie 2015 23:22:56 | |
---|---|---|---|
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, n, t; char a[30000];
ifstream f("cifra.in");
ofstream g("cifra.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;
}