Cod sursa(job #1747768)
Utilizator | Data | 25 august 2016 16:04:41 | |
---|---|---|---|
Problema | Koba | Scor | 30 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.39 kb |
#include <fstream>
using namespace std;
ifstream f("koba.in");
ofstream g("koba.out");
int n,x,y,z,t,s;
int main()
{
f >> n >> x >> y >> z;
x %= 10;
y %= 10;
z %= 10;
s = x + y + z;
while(n > 3)
{
--n;
t = (z + y * x) % 10;
s += t;
x = y;
y = z;
z = t;
}
g << s << '\n';
return 0;
}