编程介的小学生 2017-08-04 17:08 采纳率: 20.5%
浏览 766
已采纳

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

报告相同问题?

悬赏问题

  • ¥30 python代码,帮调试
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条