LeetCode编程练习
来源:互联网 发布:淘宝网店开店流程 编辑:程序博客网 时间:2024/06/06 00:09
题目:
Write an algorithm to determine if a number is "happy".
A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1. Those numbers for which this process ends in 1 are happy numbers.
Example: 19 is a happy number
12 + 92 = 82
82 + 22 = 68
62 + 82 = 100
12 + 02 + 02 = 1
定义一种快乐数,就是说对于某一个正整数,如果对其各个位上的数字分别平方,然后再加起来得到一个新的数字,再进行同样的操作,如果最终结果变成了1,则说明是快乐数,如果一直循环但不是1的话,就不是快乐数。数字19就是一个快乐数。
- LeetCode编程练习
- LeetCode编程练习
- LeetCode编程练习
- LeetCode编程练习
- LeetCode编程练习
- LeetCode编程练习
- LeetCode 编程练习
- LeetCode编程练习
- LeetCode编程练习
- LeetCode编程练习
- LeetCode编程练习
- LeetCode编程练习
- LeetCode编程练习
- LeetCode编程练习
- LeetCode编程练习
- LeetCode编程练习
- LeetCode编程练习
- LeetCode编程练习
- hadoop2.7伪分布安装配置
- LeetCode编程练习
- 谷歌扩展程序开发常用工具(Develop Tools)
- LeetCode编程练习
- antrl4学习(三)——用idea实现简单计算器
- LeetCode编程练习
- C++开发uwp的坑
- LeetCode编程练习
- Android——WiFi类
- 父子上下文的关系以及对子上下文容器中Action进行AOP(事务)的思想 (important)
- Chrome像 Firefox/IE 一样拖拉收藏网页
- 同一个文件Linux环境下和windows环境下md5_file处理出来的结果不一致
- VodeoCapture读取.avi视频报错
- DispatcherServlet 特殊的bean