Cod sursa(job #508120)
| Utilizator | Data | 7 decembrie 2010 16:30:08 | |
|---|---|---|---|
| Problema | Cifra | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.38 kb |
#include<fstream>
#include<math.h>
using namespace std;
#define InPut "cifra.in"
#define OutPut "cifra.out"
double a, t, i, j, s;
int n;
int main()
{
ifstream fin( InPut );
ofstream fout( OutPut );
fin>>t;
for(i=1;i<=t;i++)
{
fin>>a;
s=0;
for(j=1;j<=a;j++)
{s=s+pow(j,j);
n=s%10;
}
fout<<n;
fout<<"\n";
fin.close();
fout.close();
return 0;
}
}
