val result
= Iterator.
single(readInt
()) .flatMap(count ⇒ Iterator.continually(readInt()).take(count))
.
foldLeft(0)((i, max
) ⇒
if (i
> max
&& i
% 5 == 0) i
else max
) println(s"Sosnooley: $result")
}
b2JqZWN0IE1haW4gZXh0ZW5kcyBBcHAgewogIHZhbCByZXN1bHQgPSBJdGVyYXRvci5zaW5nbGUocmVhZEludCgpKQogICAgLmZsYXRNYXAoY291bnQg4oeSIEl0ZXJhdG9yLmNvbnRpbnVhbGx5KHJlYWRJbnQoKSkudGFrZShjb3VudCkpCiAgICAuZm9sZExlZnQoMCkoKGksIG1heCkg4oeSIGlmIChpID4gbWF4ICYmIGkgJSA1ID09IDApIGkgZWxzZSBtYXgpCiAgcHJpbnRsbihzIlNvc25vb2xleTogJHJlc3VsdCIpCn0=