[GESP样题 二级] 勾股数

Luogu
IDLGB3845
Time1000ms
Memory128MB
DifficultyP1
循环结构GESP
勾股数是很有趣的数学概念。如果三个正整数 $a,b,c$,满足 $a^2+b^2=c^2$,而且 $1 \le a \le b \le c$,我们就将 $a, b, c$ 组成的三元组 $(a,b,c)$ 称为勾股数。你能通过编程,数数有多少组勾股数,能够满足 $c \le n$ 吗? ## Input 输入一行,包含一个正整数 $n$。约定 $1 \le n \le 1000$。 ## Output 输出一行,包含一个整数 $C$,表示有 $C$ 组满足条件的勾股数。 [samples] ## Background 对应的选择、判断题:<https://ti.luogu.com.cn/problemset/1102> ## Note 【样例解释 1】 满足 $c \leq 5$ 的勾股数只有 $(3,4,5)$ 一组。 【样例解释 2】 满足 $c \le 13$ 的勾股数有 $3$ 组,即 $(3,4,5)$、$(6,8,10)$ 和 $(5,12,13)$。
Samples
Input #1
5
Output #1
1
Input #2
13
Output #2
3
API Response (JSON)
{
  "problem": {
    "name": "[GESP样题 二级] 勾股数",
    "description": {
      "content": "勾股数是很有趣的数学概念。如果三个正整数 $a,b,c$,满足 $a^2+b^2=c^2$,而且 $1 \\le a \\le b \\le c$,我们就将 $a, b, c$ 组成的三元组 $(a,b,c)$ 称为勾股数。你能通过编程,数数有多少组勾股数,能够满足 $c \\le n$ 吗?",
      "description_type": "Markdown"
    },
    "platform": "Luogu",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 131072
    },
    "difficulty": {
      "LuoguStyle": "P1"
    },
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "LGB3845"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "勾股数是很有趣的数学概念。如果三个正整数 $a,b,c$,满足 $a^2+b^2=c^2$,而且 $1 \\le a \\le b \\le c$,我们就将 $a, b, c$ 组成的三元组 $(a,b,c)$ 称为勾股数。你能通过编程,数数有多少组勾股数,能够满足 $c \\le n$ 吗?\n\n## Input\n\n输入一行,包含一个正整数 $n$。约定 $1 \\le n \\le 1000$。\n\n## O...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments