Cod sursa(job #798169)
Utilizator | Data | 15 octombrie 2012 20:55:03 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.37 kb |
#include<fstream>
#include<math.h>
using namespace std;
ifstream fin("cifra.in");
ofstream fout("cifra.out ");
unsigned n,s;
unsigned long long t;
int suma(unsigned x)
{ unsigned s=0;
for(unsigned j=1;j<=x;j++)
s+=pow(j,j);
return s;
}
int main()
{ fin>>t;
for(unsigned long long i=0;i<t;i++)
{
fin>>n;
fout<<suma(n)%10<<"\n";
}
return 0;
}