Cod sursa(job #781847)
Utilizator | Data | 25 august 2012 11:41:29 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.33 kb |
#include<fstream>
using namespace std;
int main()
{
ifstream fin("cifra.in");
ofstream fout("cifra.out");
long long n,x,w;
char c;
fin>>n;
for(int i=1;i<=n;++i)
{
x=0;
fin>>c;
for(int j=1;j<=c-48;++j)
{
w=1;
for(int q=1;q<=j;++q)
w=j*w;
x=x+w;
}
fout<<x%10<<"\n";
}
return 0;
}