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