Cod sursa(job #284262)
Utilizator | Data | 21 martie 2009 14:19:26 | |
---|---|---|---|
Problema | Koba | Scor | 20 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.37 kb |
#include<stdio.h>
#define uc(x) (x%10)
int main()
{
freopen("koba.in","r",stdin);
freopen("koba.out","w",stdout);
long i,t1,t2,t3,t4,s,n;
scanf("%ld%ld%ld%ld",&n,&t1,&t2,&t3);
t1=uc(t1); t2=uc(t2); t3=uc(t3);
s=t1+t2+t3;
for(i=1; i<=n-3; i++)
{
t4=uc(uc(uc(t3)+uc(t2*t1)));
s+=t4;
t1=uc(t2); t2=uc(t3); t3=uc(t4);
}
printf("%ld",s);
return 0;
}