Cod sursa(job #2390458)
Utilizator | Data | 28 martie 2019 09:02:53 | |
---|---|---|---|
Problema | Koba | Scor | 30 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.39 kb |
#include <fstream>
using namespace std;
ifstream fin("koba.in");
ofstream fout("koba.out");
int t1,t2,t3,n,t4;
long long s;
int main()
{
fin>>n>>t1>>t2>>t3;
t1%=10;
t2%=10;
t3%=10;
s=t3+t2+t1;
for(int i=4;i<=n;i++)
{
t4=t3+t2*t1;
t4%=10;
s+=t4;
t1=t2;
t2=t3;
t3=t4;
}
fout<<s;
return 0;
}