public class Solution {
public boolean isHappy(int n){
int a=0;
int sum=0;
while(n!=1){
while(n!=0){
a=n%10;
sum+=a*a;
n=n/10;
}
n=sum;
}
return true;
}
}超时……
Happy Number
最新推荐文章于 2024-07-19 09:00:00 发布