Cod sursa(job #364775)

Utilizator ProcopliucProcopliuc Adrian Procopliuc Data 16 noiembrie 2009 22:12:48
Problema Koba Scor 30
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.29 kb
# include <stdio.h>
int n,s,t1,t2,t3,i,x;
int main ()
{
freopen ("koba.in","r",stdin);
freopen ("koba.out","w",stdout);
scanf ("%i%i%i%i",&n,&t1,&t2,&t3);
s=t1%10+t2%10+t3%10;
for (i=4;i<=n;i++)
{
x=t3+t2*t1;
x=x%10;
t1=t2;
t2=t3;
t3=x;
s=s+x%10;

}

printf ("%i",s);
return 0;
}