CS240 project Problem 4
该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。
Description
Consider an infinite sequence of numbers consisting of all natural numbers arranged in ascending order. That is, consider the sequence . Let denote the 'th number in the sequence; \emph{e.g.} , etc.
Let be a given input value. Give an algorithm to compute the smallest index in where occurs. For example, if , then the index is 10, since , and no earlier substring of equals 101.
Format
Input
A string representing the value , with no more than 200 digits.
Output
he smallest positive integer for which $B_{1}=S_{k}, B_{2}=S_{k+1}, \ldots, B_{r}=S_{k+r-1}$ is true, where is the number of digits in .
Samples
input1 : 101
output1 : 10
input2 : 81
output2 : 27