IOM 2016, Блиц — Задача 33
Olympiad of Metropolises, Moscow. Blitz Contest, September, 5 · 5 септември 2016 г.
Условие
An algorithm “Editor” changes an input sequence of digits (without blanks). “Editor” has following functions:
A) Replace(v, w). This function replaces first appearance of sequence v by sequence w.
B) Find(v). This logic function return True if sequence v is in the input string like substring and False otherwise.
The algorithm description is
while find(19) or find(299) or find(3999)
replace(19, 2)
replace(299, 3)
replace(3999, 1)
end while
The input string for the algorithm is digit 1 and then 98 digits 9: 1999…999. What is the output of the algorithm?
Решение
Внимание: Непълно решение
В архива няма официално решение на тази задача.
Оригинал в Архива: blitz.pdf