Cod sursa(job #999431)
Utilizator | Data | 20 septembrie 2013 13:40:12 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.36 kb |
#include <iostream>
#include <fstream>
#include <math.h>
using namespace std;
int main()
{
ifstream in("cifra.in");
ofstream out("cifra.out");
int t,n,i,s,j;
in >> t;
for (i=1;i<=t;i++)
{
s=0;
in >> n;
for (j=1;j<=n;j++)
s=s+pow((double)j, (double)j);
out << s%10 << "\n";
}
}