# 633.Sum of Square Numbers

**633.Sum of Square Numbers**

难度:Easy

> Given a non-negative integer c, your task is to decide whether there're two integers a and b such that a2 + b2 = c.

```
Example 1:

Input: 5
Output: True
Explanation: 1 * 1 + 2 * 2 = 5
 

Example 2:

Input: 3
Output: False
```

完全平方数，直接遍历一遍，判断差是否是完全平方。

```
class Solution {
bool isSquare(int n)
{
    int tmp=sqrt(n);
    return tmp*tmp == n;
}
public:
    bool judgeSquareSum(int c) {
        for(int i=0;i<=sqrt(c);i++)
        {
            if(isSquare(c-i*i) ) return true;
        }
        return false;
    }
};
```

> 执行用时 :8 ms, 在所有 C++ 提交中击败了56.27%的用户\
> 内存消耗 :8.1 MB, 在所有 C++ 提交中击败了76.25%的用户


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dfine.gitbook.io/leetcode/633.sum_of_square_numbers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
