Cod sursa(job #893753)
Utilizator | Data | 26 februarie 2013 17:43:20 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.41 kb |
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
int T,i,j,k,l,n;
char N;
ifstream in("cifra.in");
ofstream out("cifra.out");
in>>T;
for(i=1;i<=T;i++)
{
in>>N;k=0;
for(j=1;j<=N;j++)
{
n=j;
for(l=1;l<=j;l++)
{n=n*j;
k=k+n;}
}
out<<k%10<<endl;
}
}