Cod sursa(job #125373)
| Utilizator | Data | 20 ianuarie 2008 12:42:37 | |
|---|---|---|---|
| Problema | Cifra | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.39 kb |
# include <stdio.h>
# include <math.h>
# include <string.h>
long n,i,j,t,s,s1=0,l;
char x,y;
int main ()
{
freopen ("cifra.in","r",stdin);
freopen ("cifra.out","w",stdout);
scanf ("%ld",&t);
fgetchar ();
for (i=0;i<t;i++)
{
s=0;
x=fgetchar ();
while (x!='\n')
{
y=x;
x=fgetchar();
}
l=y-48;
s=s1+pow(l,l);
s1=s%10;
printf ("%ld",s1);
printf ("\n");
}
return 0;
}
