HUNNU11352:Digit Solitaire
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> |
HUNNU11352:Digit Solitaire的更多相关文章
- 四校训练 warm up 14
A:Pythagoras's Revenge 代码: #include<cstdio> #define ll long long using namespace std; int main ...
- [LeetCode] Nth Digit 第N位
Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ... Note: n i ...
- [LeetCode] Number of Digit One 数字1的个数
Given an integer n, count the total number of digit 1 appearing in all non-negative integers less th ...
- [Leetcode] Number of Digit Ones
Given an integer n, count the total number of digit 1 appearing in all non-negative integers less th ...
- 【Codeforces715C&716E】Digit Tree 数学 + 点分治
C. Digit Tree time limit per test:3 seconds memory limit per test:256 megabytes input:standard input ...
- kaggle实战记录 =>Digit Recognizer
date:2016-09-13 今天开始注册了kaggle,从digit recognizer开始学习, 由于是第一个案例对于整个流程目前我还不够了解,首先了解大神是怎么运行怎么构思,然后模仿.这样的 ...
- [UCSD白板题] The Last Digit of a Large Fibonacci Number
Problem Introduction The Fibonacci numbers are defined as follows: \(F_0=0\), \(F_1=1\),and \(F_i=F_ ...
- Last non-zero Digit in N!(阶乘最后非0位)
Last non-zero Digit in N! Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Jav ...
- POJ3187Backward Digit Sums[杨辉三角]
Backward Digit Sums Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 6350 Accepted: 36 ...
随机推荐
- 14.6.7?Limits on InnoDB Tables InnoDB 表的限制
14.6.7?Limits on InnoDB Tables InnoDB 表的限制 警告: 不要把MySQL system tables 从MyISAM 到InnoDB 表. 这是不支持的操作,如果 ...
- 我是如何同时拿到阿里和腾讯offer的
前言 三月真是一个忙碌的季节,刚刚开学就需要准备各种面试和笔试(鄙视).幸运的是,在长达一个月的面试内推季之后,终于同时拿到了阿里和腾讯的offer,还是挺开心的.突而想起久未更新的博客,就冒昧学一学 ...
- Raspberry pi raspbain系统下使用vim
一开始 apt-get install vim不好用. 在putty中执行这条命令就可以了. sudo apt-get update && sudo apt-get install v ...
- 从头学起android<AudioManager 声音编辑器.五十.>
我们用android经常使用的时候,手机的声音增大和缩小操作.在设定场景模式,它往往使用静音和振动运行,这通常是AudioManager来控制的. 今天我们就来看一下AudioManager 的使用. ...
- 推荐一个第三方Qt库的集合
https://inqlude.org/ Stable libraries | Development versions | Unreleased | Commercial | All attica ...
- AS3开发必须掌握的内容
1.事件机制 2.显示列表 3.垃圾回收 4.常用方法 5.网络通信 6.位图动画 7.渲染机制 8.API结构 9.沙箱机制 10.资源管理 11.内存管理 12.性能优化 13.资源选择 14.安 ...
- 在浏览器中通过bartender,调用条码打印机的active控件代码的实现
系统中须要在浏览器,直接调用条码打印机,打印出产品条码. 现实中的条码打印机,品种繁多,非常难在一个程序中实现, 于是我们用已经支持全部条码打印机的bartender软件 调用它的api ,来实如今浏 ...
- Twenty Newsgroups Classification实例任务之TrainNaiveBayesJob(一)
接着上篇blog,继续看log里面的信息如下: + echo 'Training Naive Bayes model' Training Naive Bayes model + ./bin/mahou ...
- Windows移动开发(四)——闭关修炼
非常久不写博客了,不是由于不想写,仅仅是近期公司任务比較多,最终十一有时间出来冒泡了. 今天继续介绍移动开发中的重中之重--内存管理. C#代码是托管代码,C# 程序猿非常少像C/CPP程序猿那样为程 ...
- 数据挖掘 决策树算法 ID3 通俗演绎
决策树是对数据进行分类,以此达到预測的目的.该决策树方法先依据训练集数据形成决策树,假设该树不能对全部对象给出正确的分类,那么选择一些例外添�到训练集数据中,反复该过程一直到形成正确的决策集.决策树代 ...