https://leetcode-cn.com/problems/happy-number/submissions/
class Solution { public: bool isHappy(int n) { short times = 7; int num; while(n != 1 && --times) { num = 0; while(n) { num+=(n%10)*(n%10); n/=10; } n = num; } if (n == 1) return true; return false; } };