Cod sursa(job #1656147)
Utilizator | Data | 18 martie 2016 20:09:24 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.31 kb |
#include <iostream>
#include <math.h>
using namespace std;
long t,i,S,n,j,x;
int main()
{ cin>>t;
for(i=1;i<=t;i++)
{
cin>>n;
S=0;
for(j=1;j<=n;j++)
{long x=pow(j,j);
S=(S+x)%10;
}
cout<<S%10<<endl;
}
return 0;
}