编程介的小学生 2017-07-31 06:29 采纳率: 20.5%
浏览 704
已采纳

Subnumber

George likes arithmetics very much. Especially he likes the natural numbers series. His most favourite thing is the infinite sequence of digits, which results as the concatenation of all natural numbers in ascending order. The beginning of this sequence is 1234567891011121314... Let us call this sequence S. Then S[1] = 1, S[2] = 2, ..., S[10] = 1, S[11] = 0, ... , and so on.

George takes a sequence of digits A and wants to know when it first appears in S. Help him to solve this difficult problem.

Input

The first line of the input file contains A - the given sequence of digits. The number of digits in A does not exceed 200.

Process to the end of file.

Output

Output file must contain the only number - the least k such that A[1] = S[k], A[2] = S[k+1], ... A[len(A)] = S[k + len(A) - 1], where len(A) denotes the length of A (i.e. the number of digits in it).

Sample Input

101
123

Sample Output

10
1

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-08-15 21:58
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?