Problem description |
Despite the glorious fall colors in the midwest, there is a great deal of time to spend while on a train from St. Louis to Chicago. On a recent trip, we passed some time with the following game. We start with a positive integer S. So long as it has more than one digit, we compute the product of its digits and repeat. For example, if starting with 95, we compute 9 × 5 = 45 . Since 45 has more than one digit, we compute 4 × 5 = 20 . Continuing with 20, we compute 2 × 0 = 0 . Having reached 0, which is a single-digit number, the game is over. As a second example, if we begin with 396, we get the following computations: 3 × 9 × 6 = 162 1 × 6 × 2 = 12 1 × 2 = 2 |
Input |
Each line contains a single integer 1 ≤ S ≤ 100000, designating the starting value. The value S will not have any leading zeros. A value of 0 designates the end of the input. |
Output |
For each nonzero input value, a single line of output should express the ordered sequence of values that are considered during the game, starting with the original value. |
Sample Input |
95 |
Sample Output |
95 45 20 0396 162 12 228 16 6440 0 题意:给出一个数字,将每一位相乘得到下一个数字,知道数字位数为1则停止,输出所有情况 水题,不解释 #include <stdio.h> |
相关文章
- 03-27HUNNU11352:Digit Solitaire
- 03-27[Swift Weekly Contest 128]LeetCode1015. 至少有 1 位重复的数字 | Numbers With 1 Repeated Digit
- 03-27计算字符串中al_num,spance_num,digit_num,other_num的个数
- 03-27【博弈论】【SG函数】bzoj3404 [Usaco2009 Open]Cow Digit Game又见数字游戏
- 03-27UVa 1583 Digit Generator WA
- 03-27生成元(Digit Generator,ACM/ICPC Seoul 2005,UVa 1583)
- 03-27UVA1225Digit Counting
- 03-27【HDOJ】1061 Rightmost Digit
- 03-27HDU 1061 Rightmost Digit解决问题的方法
- 03-27LeetCode OJ 之 Number of Digit One (数字1的个数)