编程介的小学生 2017-09-24 15:28 采纳率: 20.5%
浏览 743
已采纳

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-10-12 15:47
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序