Cod sursa(job #1497113)
Utilizator | Data | 6 octombrie 2015 08:34:25 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.35 kb |
#include <iostream>
#include <fstream>
#include <math.h>
using namespace std;
ifstream in ("cifra.in");
ofstream out("cifra.out");
int main()
{unsigned long long n ;
unsigned int t;
unsigned short s=0;
in >> t ;
for (int i=1 ; i<=t ; i++)
{s=0;
in >> n;
for (int j=1;j<=n;j++)
{s=s+pow(j,j);}
s=s%10; out <<s<<'\n' ;}
return 0;
}