Cod sursa(job #275332)

Utilizator mathboyDragos-Alin Rotaru mathboy Data 10 martie 2009 13:20:17
Problema Koba Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.28 kb
#include <fstream.h>
ifstream f("koba.in");
ofstream g("koba.out");
int main()
{
long long n,t[1000000],i,s=0;
f>>n>>x>>y>>z;
t[1]=x%10;t[2]=y%10;t[3]=z%10;s=t[1]+t[2]+t[3];
for(i=4;i<=n;i++)
	{ t[i]=(t[i-1]%10+t[i-2]%10*t[i-3]%10);
	s+=t[i]%10;
	}
	g<<s;
	return 0;
        }