标签:ext [] == win turn class bool span color
1 static int wing=[]() 2 { 3 std::ios::sync_with_stdio(); 4 cin.tie(NULL); 5 return 0; 6 }(); 7 8 class Solution 9 { 10 public: 11 bool isHappy(int n) 12 { 13 while(n>6) 14 { 15 int next=0; 16 while(n) 17 { 18 int a=n%10; 19 next+=a*a; 20 n/=10; 21 } 22 n=next; 23 } 24 return n==1; 25 } 26 };
找欢乐逗比数,一级一级算,直到最后数字小于6,小于6的数字中,只有1是欢乐数。
标签:ext [] == win turn class bool span color
原文地址:https://www.cnblogs.com/zhuangbijingdeboke/p/9073531.html