葉林
Linked with GitHub
# 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; } }; ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up