Cod sursa(job #274645)

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