Cod sursa(job #1736511)
Utilizator | Micu Emerson Emy1337 | Data | 1 august 2016 21:07:14 |
---|---|---|---|
Problema | Koba | Scor | 30 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.42 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("koba.in");
ofstream fout("koba.out");
int n, t1, t2, t3;
long long s = 0;
int main()
{
fin>>n>>t1>>t2>>t3;
t1 %=10;
t2 %=10;
t3 %=10;
s += t1+t2+t3;
while(n>3)
{
n--;
int aux = ( t3 + t2 * t1 ) %10;
s += aux;
t1 = t2;
t2 = t3;
t3 = aux;
}
fout<<s;
}