1、202快乐数
class Solution {
public:
int Sum(int n)
{
int res = 0;
while (n)
{
res+= (n % 10) * (n % 10);
n = n / 10;
}
return res;
}
bool isHappy(int n) {
unordered_map<int, int>m;
while (1)
{
int res = Sum(n);
if (res == 1)return true;
if (m.find(res) != m.end())return false;
m[res] = 1;
n = res;
}
}
};
class Solution {
public:
int Sum(