E. CS240 project Problem 4

    传统题 2000ms 256MiB

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 S=12345678910111213141516171819202122S = 12345678910111213141516171819202122 \ldots. Let SiS_i denote the ii'th number in the sequence; \emph{e.g.} S1=1,S2=2,,S10=1,S11=0S_1 = 1, S_2 = 2, \ldots, S_{10} = 1, S_{11} = 0, etc.

Let BB be a given input value. Give an algorithm to compute the smallest index in SS where BB occurs. For example, if B=101B=101, then the index is 10, since S10S11S12=101S_{10} S_{11} S_{12} = 101, and no earlier substring of SS equals 101.

Format

Input

A string representing the value BB, with no more than 200 digits.

Output

he smallest positive integer kk for which $B_{1}=S_{k}, B_{2}=S_{k+1}, \ldots, B_{r}=S_{k+r-1}$ is true, where rr is the number of digits in BB.

Samples

input1 : 101
output1 : 10
input2 : 81
output2 : 27

CS240 project Problem

未参加
状态
已结束
规则
IOI
题目
5
开始于
2023-5-16 10:00
结束于
2023-6-6 23:59
持续时间
518 小时
主持人
参赛人数
92