Cod sursa(job #261708)
Utilizator | Data | 18 februarie 2009 18:28:31 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.27 kb |
#include <fstream.h>
#include <math.h>
void main ()
{ int t,k,i,n,s;
ifstream f("cifra.in");
ofstream g("cifra.out");
f>>t;
for (i=1;i<=t;i++)
{ s=0;
f>>k;
for (n=1;n<=k;n++)
s=s+pow(n,n);
g<<s%10<<endl;
}
g.close ();
f.close ();
}