Cod sursa(job #873558)
Utilizator | Data | 7 februarie 2013 13:24:26 | |
---|---|---|---|
Problema | Koba | Scor | 30 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.35 kb |
#include<fstream>
using namespace std;
int n,t1,t2,t3,c,i,s;
int main()
{
ifstream f("koba.in");
ofstream g("koba.out");
f>>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;
}
g<<s;
}