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 ...
随机推荐
- 移动端网页JS框架-手机触摸事件框架,日历框架带滑动效果
swiper.js,hammer.js,mobiscroll http://www.mobiscroll.com/ 日历
- sql语句查询添加自增列
SELECT Row_Number() over ( order by getdate() ) as '序号', * FROM T_Cod_XQ
- 百度地图 javascript相关Bug搜集
一 在手机里用百度地图js版做webapp bug集合 1 之前用2.0版本的时候发现只要地图添加了覆盖物,无论数量多少,当地图放大到很小的范围时候,会卡死 1.1 当时处理办法:将版本降低至1. ...
- c 有意思的数组初始化
c 有意思的数组初始化 #include <stdio.h> int main() { int i = 0; char a[1024]; char a0[10] = {}; char a1 ...
- hadoop format过程
private static boolean format(Configuration conf, boolean isConfirmationNeeded ) throws IOException ...
- VC 中与字符串相关的宏 _T、TEXT,_TEXT、L 的作用(简单明了)
一. 在字符串前加一个L作用: 如 L"我的字符串" 表示将ANSI字符串转换成unicode的字符串,就是每个字符占用两个字节. strlen("as ...
- Java Web Services (0) - Overview
前言第1章 Web服务快速入门 1.1 Web服务杂项 1.2 Web服务有什么好处 1.3 Web服务和面向服务的架构 1.4 Web服务简史 1.4.1 从DCE/RPC到XML-RPC 1.4. ...
- Lambda高手之路第二部分
转http://www.cnblogs.com/lazycoding/archive/2013/01/06/2847579.html 闭包的影响 为了展示闭包的影响,我们看下面这个例子. var bu ...
- 数字雨Shopex 4.8.5 SQL Injection Exp
# -*- coding:utf-8 -* #Author:MXi4oyu #Email:798033502@qq.com #Shopex 4.8.5 SQL Injection Exp #转载请说明 ...
- Android ARM汇编语言
简介 ARM是Advanced RISC Machine的首字母缩写,它可以称之为一家嵌入式处理器的提供商,也可以理解为一种处理器的架构,还可以将它作为一套完整的处理器指令集. 原生程序与ARM汇编语 ...