Cod sursa(job #389116)
Utilizator | Data | 31 ianuarie 2010 22:21:24 | |
---|---|---|---|
Problema | Koba | Scor | 30 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.29 kb |
# include <fstream>
using namespace std;
int main ()
{
ifstream fin ("koba.in");
ofstream fout ("koba.out");
int n, t1, t2, t3, s, t;
fin>>n>>t1>>t2>>t3;
s=t1%10+t2%10+t3%10;
for (int i=4;i<=n;i++)
{
t=t3+t2*t1;
t1=t2%10;t2=t3%10;t3=t%10;
s+=t%10;
}
fout<<s;
return 0;
}