[GESP202406 二级] 平方之和

Luogu
IDLGB4002
Time1000ms
Memory512MB
DifficultyP1
2024循环结构GESP
小杨有 $n$ 个正整数 $a_1,a_2,\dots,a_n$,他想知道对于所有的 $i (1\le i\le n)$,是否存在两个正整数 $x$ 和 $y$ 满足 $x\times x+y \times y=a_i$。 ## Input 第一行包含一个正整数 $n$,代表正整数数量。 之后 $n$ 行,每行包含一个正整数,代表 $a_i$。 ## Output 对于每个正整数 $a_i$,如果存在两个正整数 $x$ 和 $y$ 满足 $x\times x+y \times y=a_i$,输出 `Yes`,否则输出 `No`。 [samples] ## Background 对应的选择、判断题:<https://ti.luogu.com.cn/problemset/1150> ## Note 对于第一个正整数,存在 $1\times 1+2 \times 2=5$,因此答案为 `Yes`。 对于全部数据,保证有 $1 \le n \le 10,1 \le a_i \le 10^6$。
Samples
Input #1
2
5
4
Output #1
Yes
No
API Response (JSON)
{
  "problem": {
    "name": "[GESP202406 二级] 平方之和",
    "description": {
      "content": "小杨有 $n$ 个正整数 $a_1,a_2,\\dots,a_n$,他想知道对于所有的 $i (1\\le i\\le n)$,是否存在两个正整数 $x$ 和 $y$ 满足 $x\\times x+y \\times y=a_i$。",
      "description_type": "Markdown"
    },
    "platform": "Luogu",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 524288
    },
    "difficulty": {
      "LuoguStyle": "P1"
    },
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "LGB4002"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "小杨有 $n$ 个正整数 $a_1,a_2,\\dots,a_n$,他想知道对于所有的 $i (1\\le i\\le n)$,是否存在两个正整数 $x$ 和 $y$ 满足 $x\\times x+y \\times y=a_i$。\n\n## Input\n\n第一行包含一个正整数 $n$,代表正整数数量。\n之后 $n$ 行,每行包含一个正整数,代表 $a_i$。\n\n## Output\n\n对于每个正整数 $a_i...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments