Cod sursa(job #675862)
Utilizator | Data | 8 februarie 2012 13:06:26 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.32 kb |
#include <fstream>
#include <cmath>
using namespace std;
ifstream f("cifra.in");
ofstream g("cifra.out");
int T,N,i,y,u;
double s;
int main()
{
f>>T;
for (i=1;i<=T;i++)
{
s=0;
f>>N;
for (y=1;y<=N;y++)
s=s+pow(y,y);
u=((long)s)%10;
g<<u<<endl;
}
f.close(); g.close();
return 0;
}