Pagini recente » Cod sursa (job #664604) | Cod sursa (job #468072) | Cod sursa (job #606660) | Cod sursa (job #2600268) | Cod sursa (job #1470294)
#include <fstream>
#define S 94
using namespace std;
ofstream fout ("cifra.out");
ifstream fin ("cifra.in");
int main()
{
int n, x, s;
fin >> n;
for (int i = 0; i < n; i++)
{
fin >> x;
int tmp = x;
s = S * ((int)(x / 20));
for (int o = 0; o <= ((int)(x % 20)); o++){
int tmp = o;
for (int j = 1; j < o; j++)
tmp = (tmp * o) % 10;
s+= tmp;
}
fout << s % 10 << "\n";
}
return 0;
}