Cod sursa(job #308311)

Utilizator andrici_cezarAndrici Cezar andrici_cezar Data 26 aprilie 2009 18:50:54
Problema Koba Scor 30
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.27 kb
#include<fstream.h>

long n,t,t2,t3,i,t1,s;

int main()

{
ifstream f("koba.in");
ofstream g("koba.out");
f>>n>>t>>t2>>t3;
t%=10;
t2%=10;
t3%=10;
s+=t+t2+t3;
for (i=4;i<=n;i++)
{
t1=(t3+t2*t)%10;
t=t2;t2=t3;t3=t1;
s+=t1;}
g<<s<<'\n';
g.close();
return 0;
}