Cod sursa(job #791559)
Utilizator | Data | 24 septembrie 2012 16:23:42 | |
---|---|---|---|
Problema | Koba | Scor | 30 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.29 kb |
#include<fstream>
using namespace std;
int n,t1,t2,t3,c,i,s;
int main()
{
ifstream in("koba.in");
ofstream out("koba.out");
in>>n>>t1>>t2>>t3;
t1=t1%10;
t2=t2%10;
t3=t3%10;
s=t1+t2+t3;
for(i=4;i<=n;i++)
{
c=t3;
t3=(t3+t2*t1)%10;
s+=t3;
t1=t2;
t2=c;
}
out<<s;
}