eolymp
bolt
Спробуйте наш новий інтерфейс для відправки розв'язків
Задачі

Revenge of Champernowne Constant

Revenge of Champernowne Constant

Champernowne constant is an irrational number. Its decimal representation starts with "\textbf{0.}", followed by concatenation of all positive integers in the increasing order. You will be given a sequence \textbf{S} which consists of decimal digits. Your task is to write a program which computes the position of the fi rst occurrence of \textbf{S} in Champernowne constant after the decimal point. \InputFile The input has multiple test cases. Each line of the input has one digit sequence. The input is terminated by a line consisting only of \textbf{#}. It is guaranteed that each sequence has at least one digit and its length is less than or equal to \textbf{100}. \OutputFile For each sequence, output one decimal integer described above. You can assume each output value is less than \textbf{10^16}.
Ліміт часу 30 секунд
Ліміт використання пам'яті 256 MiB
Вхідні дані #1
45678
67891011
21
314159265358979
#
Вихідні дані #1
4
6
15
2012778692735799
Джерело ACM International Collegiate Programming Contest JAG Practice Contest, Tokyo, 2011-11-06