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 ...
随机推荐
- C中的几组指针
1.二维数组 下面就三种二维数组进行说明. 1: int **Ptr; 2: int *Ptr[ 5 ]; 3: int ( *Ptr )[ 5 ]; 以上三例都是整数的二维数组,都可以用形如 Ptr ...
- PLSQL数据导入
导入数据 (1) 首先以管理员身份登录plsql; (2) 新建命令窗口 (3) 创建用户,设置帐号,密码 创建语句:create user usernameidenti ...
- 关于Android配色 自适应颜色的实现
在Android4.4系统中,更加详细地介绍了关于颜色的细节并提供了使用colour的新教程,以使我们的应用更加独一无二.也就是说,作为一个设计师或者开发者,为你的APP做完美的配色已经变成了你的职责 ...
- Android使用ksoap2-android调用WebService学习
之前主要做客户端UI交互,很少处理数据和接触服务端,但现在的移动设备根本不可能离得开网络连接,数据的交换.最近学习的是在android端如何去调用远程WebService,都说WebService是一 ...
- sofa-pbrpc 1.1.1 发布,RPC 网络通信库
https://www.oschina.net/news/77372/sofa-pbrpc-1-1-1 https://www.oschina.net/p/sofa-pbrpc
- 关于IOCP,某些地方就是不让人彻底舒服(WSASend重叠post数据)
开门见山,直接就事论事. 假如有这么一个基于IOCP模型的Server,这个Server提供的所有服务中有这么一种服务……文件下载,我们再假设Server端存有一个20G的文件,客户端这时发送一个请求 ...
- ExtJs4 笔记(10) Ext.tab.Panel 选项卡
本篇讲解选项卡控件. 一.基本选项卡 首先我们来定义一个基本的选项卡控件,其中每个Tab各有不同,Tab的正文内容可以有三种方式获取: 1.基本方式:通过定义html和items的方式. 2.读取其他 ...
- ASP.NET 应用程序(Application)生命周期概述
原文:ASP.NET 应用程序(Application)生命周期概述 引用MSDN:ASP.NET 应用程序生命周期概述 本 主题概述应用程序生命周期,列出重要的生命周期事件,并描述如何编写适合应用程 ...
- iOS 开发百问(6)
61.警告"addexplicit braces to avoid dangling else" 所谓"危急的else"是相似这种代码: if(a== 10) ...
- 在安装mysql出现的错误以及解决方法
因为手贱更新了一下驱动,结果导致无线网卡出了问题.然而就算是从官网上下载了驱动各种折腾也没有弄好,心里特别堵.无奈只有重装系统这一条路了.这里表示特别难过,因为电脑上东西实在太多了,而且各种环境变量. ...