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 ...
随机推荐
- Qt4创建工程的几种方法:linux系统
方法一:以Qt Creator 作为IDE 1.启动Qt Creator,并创建一个空项目 2.输入路径和工程名字 3.添加cpp文件 4.添加代码,并且编译执行 5.执行结果 方法二:利用linux ...
- FOJ 1607 Greedy division 数学题
题目地址: http://acm.fzu.edu.cn/problem.php?pid=1607 给定一个n,将n平均分成m份,问有几种方法,每种方法中找出最大的数.思路:就是求n的因子数.先将每个数 ...
- Swift - 高级运算符介绍
除了基本运算符之外,Swift还支持位运算和位移运算,包括: 1,按位取反运算:操作符是 ~ 2,按位与运算:操作符是 & 3,按位或运算:操作符是 | 4,按位异或运算:操作符是 ^ 5 ...
- 【自由谈】城域网IPv6过渡技术——MAP技术(4)
本节接着回答MAP技术的第三个问题:“MAP-BR的Pool是如何实现?可靠性如何提升?” 在MAP域中通过将多个MAP-BR放在同一个Pool内实现负载分担和保护倒换的.同一个Pool中的每个MAP ...
- Delphi的没落有三个原因(比较贴切)
Delphi的没落有三个原因:1,Object pascal并没有像C/C++那样成为业内标准. 如果你使用C或C++写程序,可以在任何地方进行编译,例如Windows.Linux.手机,甚至是单片机 ...
- ZOJ 1171 Sorting the Photos
1. 题目描述 给你一叠照片,有的正面朝上,有的反面朝上,朝上的用字母U,朝下的用字母D 可以从一个位置开始到最顶端,把这一叠拿出来,反转,然后再放回那一叠照片上面. 试求出最少的翻转次数,使所有的照 ...
- linux下安装QT过程
说QT是linux下主要的图形开发工具一点都不过分,虽然诺基亚公司放弃Meego.遣散了Qt开发团队,但是它的各种商业.企业版本还是的到了很好的保护,linux下的开发工具集里还是经常看到它的身影,毕 ...
- 我经历的IT公司面试及离职感受(转)
毕业后几年一直待在广州,觉得这是一个比较生活化及务实的城市,其互联网公司和相应的投融资环境都不如北深上活跃,大大小小的面试也有几十个,有点规模的公司应该都面试过了,面试一般会见到主力技术人员,技术主管 ...
- VMware中linux与window目录共享
在虚拟机下来实如今windows下共享一个目录: (前提已安装完毕vmtools:http://blog.csdn.net/pipisorry/article/details/21318931) 打开 ...
- hdu 4888 Redraw Beautiful Drawings 最大流
好难好难,将行列当成X和Y,源汇点连接各自的X,Y集,容量为行列的和,相当于从源点流向每一行,然后分配流量给每一列,最后流入汇点,这样执意要推断最后是否满流,就知道有没有解,而解就是每一行流向每一列多 ...