Cod sursa(job #983698)
Utilizator | Data | 12 august 2013 16:03:12 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.38 kb |
#include <fstream>
#include <cmath>
using namespace std;
int main()
{
ifstream f("cifra.in");
ofstream g("cifra.out");
long long int t,n,suma=0,i,j;
f>>t;
for(i=1;i<=t;i++)
{
f>>n;
suma=0;
for(j=1;j<=n;j++)
suma=suma+pow(j,j);
g<<suma%10<<endl;
}
f.close();
g.close();
return 0;
}