编程介的小学生 2020-06-22 07:46 采纳率: 20.5%
浏览 242
已结题

Digits 数字位数的问题

Problem Description

A googol written out in decimal has 101 digits. A googolplex has one plus a googol digits. That's a lot of digits!

Given any number x0, define a sequence using the following recurrence:

xi+1 = the number of digits in the decimal representation of xi

Your task is to determine the smallest positive i such that xi = xi-1.

Input
Input consists of several lines. Each line contains a value of x0. Every value of x0 is non-negative and has no more than one million digits. The last line of input contains the word END.

Output
For each value of x0 given in the input, output one line containing the smallest positive i such that xi = xi-1.

Sample Input
42
END

Sample Output
3

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 Pwm双极模式H桥驱动控制电机
    • ¥30 这是哪个作者做的宝宝起名网站
    • ¥60 版本过低apk如何修改可以兼容新的安卓系统
    • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
    • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
    • ¥50 有数据,怎么用matlab求全要素生产率
    • ¥15 TI的insta-spin例程
    • ¥15 完成下列问题完成下列问题
    • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
    • ¥15 YoloV5 第三方库的版本对照问题