ACM——Digital Roots
http://acm.njupt.edu.cn/acmhome/problemdetail.do?&method=showdetail&id=1028
Digital Roots
总提交:493 测试通过:175
描述
The digital root of a positive integer is found by summing the digits of the integer. If the resulting value is a single digit then that digit is the digital root. If the resulting value contains two or more digits, those digits are summed and the process is repeated. This is continued as long as necessary to obtain a single digit.
For example, consider the positive integer 24. Adding the 2 and the 4 yields a value of 6. Since 6 is a single digit, 6 is the digital root of 24. Now consider the positive integer 39. Adding the 3 and the 9 yields 12. Since 12 is not a single digit, the process must be repeated. Adding the 1 and the 2 yeilds 3, a single digit and also the digital root of 39.
输入
The input file will contain a list of positive integers, one per line. The end of the input will be indicated by an integer value of zero.
输出
For each integer in the input, output its digital root on a separate line of the output.
样例输入
24
39
0
样例输出
6
3
题目来源
Greater New York 2000


ACM——Digital Roots的更多相关文章
- HDU 1013 Digital Roots【字符串,水】
		
Digital Roots Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Tot ...
 - HDU 1013 Digital Roots(to_string的具体运用)
		
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1013 Digital Roots Time Limit: 2000/1000 MS (Java/Othe ...
 - Digital Roots  1013
		
Digital Roots 时间限制(普通/Java):1000MS/3000MS 运行内存限制:65536KByte总提交:456 测试通过:162 描述 T ...
 - Eddy's digital Roots
		
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission( ...
 - Digital Roots                                                       分类:            HDU             2015-06-19 22:56    13人阅读    评论(0)    收藏
		
Digital Roots Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total ...
 - HDU 1163 Eddy's digital Roots
		
Eddy's digital Roots Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Oth ...
 - HDOJ 1163 Eddy's digital Roots(九余数定理的应用)
		
Problem Description The digital root of a positive integer is found by summing the digits of the int ...
 - Eddy's digital Roots(九余数定理)
		
Eddy's digital Roots Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Oth ...
 - HDU1163 Eddy's digital Roots【九剩余定理】
		
Eddy's digital Roots Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Oth ...
 
随机推荐
- eclipse下使用tomcat启动maven项目
			
最近学习使用maven,建立了一个maven项目使用eclipse下tomcat启动时报错: 严重: ContainerBase.addChild: start: org.apache.catalin ...
 - openstack 在线repo
			
https://repos.fedorapeople.org/repos/openstack/openstack-kilo/
 - tcp/udp socket编程异同
			
一.TCP与UDP的区别 基于连接与无连接 对系统资源的要求(TCP较多,UDP少) UDP程序结构较简单 流模式与数据报模式 TCP保证数据正确性,UDP可能丢包 TCP保证数据顺序,UDP不保证 ...
 - centos firefox中文乱码问题
			
下载两个rpm包 fonts-chinese-3.02-9.6.e15.noarch.rpm fonts-ISO8859-2-75dpi-1.0-17.1.noarch.rpm 然后安装rmp rpm ...
 - 11个高级MySQL数据库面试问题和答案
			
因为有大家的支持,我们才能做到现在,感谢你们这一路上对我们的支持.在这篇文章中,我们将主要针对MySQL的实用技巧,讲讲面试中相关的问题. 1. 如何使用SELECT语句找到你正在运行的服务器的版本并 ...
 - iOS开发—字典转模型,KVC设计模式
			
iOS开发UI基础—字典转模型 开发中,通常使用第三方框架可以很快的实现通过字典转模型,通过plist创建模型,将字典的键值对转成模型属性,将模型转成字典,通过模型数组来创建一个字典数组,通过字典数组 ...
 - hdu 2212
			
1.简单的思维问题 各个位上阶乘的和 要和这个数相匹配 这样才能得到正确的解.各个位上阶乘的和 是最大是9*9!这样来求解.999999999 9个9 最大的各个位上的阶乘的和为3265920=9 ...
 - iOS动画详解(一)
			
Core Graphics Framework是一套基于C的API框架,使用了Quartz作为绘图引擎.它提供了低级别.轻量级.高保真度的2D渲染.该框架可以用于基于路径的绘图.变换.颜色管理.脱屏渲 ...
 - iOS Instruments内存检测使用
			
Instruments 可以帮我们了解到应用程序使用内存的几个方面: 全局内存使用情况(Overall Memory Use): 从全局的角度监测应用程序的内存使用情况,捕捉非预期的或大幅度的内存增长 ...
 - MySQL主从复制技术(纯干货)
			
1.复制配置 主机一定要开启二进制日志(这里建议配置RBR) 每个主机和每个从机一定要配置一个位移的id,即server-id 每个从机配置一定要包含主机名称,日志名称,和位置 ...