Cod sursa(job #252832)
Utilizator | Data | 4 februarie 2009 22:49:51 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.28 kb |
#include<fstream.h>
#include<math.h>
int main()
{unsigned long p;
int N,T,s,i;
ifstream f("cifra.in");
ofstream g("cifra.out");
f>>T;
for(i=1;i<=T;i++)
{f>>N;p=0;
for(s=1;s<=N;s++)
{p=p+pow(s,s);}
g<<p%10<<endl;}
f.close();
g.close();
return 0;
}