Cod sursa(job #2029818)
Utilizator | Data | 30 septembrie 2017 14:59:32 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.38 kb |
#include <iostream>
#include <fstream>
#include <math.h>
using namespace std;
int main()
{
fstream in("cifra.in");
ofstream out("cifra.out");
int t,n,k;
in>>t;
for(int i=1;i<=t;i++)
{
in>>n;
k=0;
for(int j=1;j<=n;j++)
k=k+pow(j,j);
out<<k%10<<endl;
}
return 0;
}