Cod sursa(job #2113917)
Utilizator | Data | 25 ianuarie 2018 11:32:50 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.34 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin ("cifra.in");
ofstream fout ("cifra.out");
long long n,x,p,q,s;
int main()
{fin>>n;
while(n)
{
n--;
fin>>x;
q=x%10;
p=x-1;
while(p)
{
q=(q*x)%10;
p--;
}
s=s%10+q;
fout<<s%10<<"\n";
}
return 0;
}