P27875 [洛谷] [GESP Sample Question Level 2] Pythagorean Triplets
普及-
题目描述

Problem Description

Pythagorean triplets are an interesting mathematical concept. If three positive integers \(a, b, c\) satisfy \(a^2 + b^2 = c^2\) and \(1 \le a \le b \le c\), we call the triplet \((a, b, c)\) a Pythagorean triplet. Can you program to count how many such Pythagorean triplets exist where \(c \le n\)?

Input Format

Input consists of a single line containing a positive integer \(n\). It is guaranteed that \(1 \le n \le 1000\).

Output Format

Output a single line containing an integer \(C\), which represents the number of Pythagorean triplets that satisfy the condition.

Sample Input and Output

Sample Input #1

5

Sample Output #1

1

Sample Input #2

13

Sample Output #2

3

Notes

Sample Explanation 1

The only Pythagorean triplet where \(c \le 5\) is \((3, 4, 5)\).

Sample Explanation 2

There are 3 Pythagorean triplets where \(c \le 13\), which are \((3, 4, 5)\), \((6, 8, 10)\), and \((5, 12, 13)\).

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
5
样例输出
1