Cod sursa(job #1840662)
Utilizator | Data | 4 ianuarie 2017 18:17:09 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.41 kb |
#include <fstream>
#include <math.h>
using namespace std;
ifstream f("cifra.in");
ofstream g("cifra.out");
long long n,i,j,x,t,c,s,p;
int main()
{
f>>n;
for(i=1; i<=n; i++)
{
f>>x;
s=0;
for(j=1; j<=x; j++)
{
p=j;
t=pow(j,p);
t=t%10;
s=s+t;
}
g<<s%10<<endl;
}
return 0;
}