Cod sursa(job #495593)
Utilizator | Data | 25 octombrie 2010 21:29:01 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.3 kb |
#include<stdio.h>
#include<math.h>
int main()
{
freopen("ucif.in","r",stdin);
freopen("ucif.out","w",stdout);
int n,i=1,k;
long s=0,p,r;
scanf("%d",&n);
while(i<=n)
{
r=i%4;
if(r==0)
r=4;
p=pow(i%10,r);
s=(s+p%10)%10;
i++;
}
k=s%10;
printf("%d",k);
return 0;
}