Cod sursa(job #30660)
Utilizator | Data | 14 martie 2007 20:30:29 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.29 kb |
#include<fstream.h>
#include<math.h>
int main() {
ifstream f("cifra.in");
ofstream g("cifra.out");
int t,i,j,s[100],S,x;
double n;
f>>t;
for(i=1;i<=t;i++)
{f>>n;S=0;
for(j=1;j<=n;j++)
{x=pow(j%10,j%10);
S+=(int)x%10;}
g<<S%10<<'\n';
}
f.close();
g.close();
return 0;
}