Cod sursa(job #679784)
| Utilizator | Data | 13 februarie 2012 18:57:11 | |
|---|---|---|---|
| Problema | Cifra | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.38 kb |
#include <fstream>
#include <iostream>
using namespace std;
ifstream fin("cifra.in");
ofstream fout("cifra.out");
int main ()
{
long long s=0,n=0,t=0,i,j,k,aux;
fin>>t;
for (i=1;i<=t;i++)
{
fin>>n;
for (j=1;j<=n;j++)
{
aux=j;
for (k=1;k<=j-1;k++)
aux=aux*j;
s=s+aux;
}
fout<<s%10<<"\n";
s=0;
}
fin.close ();
fout.close ();
return 0;
}