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