Pagini recente » Diferente pentru problema/mario2 intre reviziile 5 si 4 | Cod sursa (job #2067191) | Cod sursa (job #1702497) | Cod sursa (job #1593398) | Cod sursa (job #1521179)
#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;
}