fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. /*
  5. ] A happy number is a number defined by the following process:
  6. Starting with any positive integer, replace the number by the sum of the squares of its digits.
  7. Repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1.
  8. Those numbers for which this process ends in 1 are happy.
  9. Return true if n is a happy number, and false if not.
  10.  
  11. Example:
  12. Input: n = 19Output: trueExplanation:12 + 92 = 82
  13. 82 + 22 = 68
  14. 62 + 82 = 100
  15. 12 + 02 + 02 = 1
  16.  
  17. Example:
  18. Input: n = 2Output: false
  19. */
  20.  
  21. int main() {
  22.  
  23. return 0;
  24. }
Success #stdin #stdout 0.01s 5324KB
stdin
Standard input is empty
stdout
Standard output is empty