Cod sursa(job #698820)
Utilizator | Data | 29 februarie 2012 16:14:14 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.41 kb |
#include <fstream>
#include <cmath>
using namespace std;
ifstream f("cifra.in");
ofstream g("cifra.out");
int t,i,n,s,c,j;
int main()
{
f>>t;
for (i=1;i<=t;i++)
{
f>>n;
s=0;
for (j=1;j<=n;j++)
{
s=s+pow(j,j);
}
g<<s%10<<'\n';
}
f.close();
g.close();
return 0;
}