# LeetCode - 0633. Sum of Square Numbers ### 題目網址:https://leetcode.com/problems/sum-of-square-numbers/ ###### tags: `LeetCode` `Medium` `數學` `數論` ```cpp= /* -LeetCode format- Problem: 633. Sum of Square Numbers Difficulty: Medium by Inversionpeter */ class Solution { public: bool judgeSquareSum(int c) { for (int i = 2; i <= sqrt(c); ++i) if (!(c % i)) { int counts = 0; while (!(c % i)) { ++counts; c /= i; } if ((i & 3) == 3 && (counts & 1)) return false; } return (c & 3) != 3; } }; ```