Cod sursa(job #1127557)
Utilizator | Data | 27 februarie 2014 12:54:21 | |
---|---|---|---|
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 f("cifra.in");
ofstream g("cifra.out");
int n;
long t,s,i,j;
f>>t; s=0;
for (i=1; i<=t; i++)
{
f>>n; s=0;
for (j=1; j<=n; j++)
s=(s+(long)pow(j,j))%10;
g<<s<<'\n';
}
f.close(); g.close();
return 0;
}