Cod sursa(job #254863)
Utilizator | Data | 7 februarie 2009 21:20:46 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.25 kb |
#include <fstream.h>
#include <math.h>
ifstream f("cifra.in");
ofstream g("cifra.out");
int main()
{
long unsigned t,n,s,i,j;
f>>t;
for(i=1;i<=t;i++)
{ f>>n;s=0;
for(j=1;j<=n;j++) s=s+pow(j%10,j%10);
g<<s%10<<endl; }
return 0; }