葉林
Linked with GitHub
# LeetCode - 1925. Count Square Sum Triples ### 題目網址:https://leetcode.com/problems/count-square-sum-triples/ ###### tags: `LeetCode` `Easy` `數學` ```cpp= /* -LeetCode format- Problem: 1925. Count Square Sum Triples Difficulty: Easy by Inversionpeter */ class Solution { public: int countTriples(int n) { int counts = 0, k; for (int i = 3; i <= n; ++i) for (int j = i + 1; j <= n; ++j) { k = sqrt(i * i + j * j); if (k <= n && i * i + j * j == k * k) ++counts; } return counts << 1; } }; ```
×
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