問題一覧 > 通常問題

No.2979 Number of Right Triangles

レベル : / AI推定難易度 : 2700 / 実行時間制限 : 1ケース 4.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 16
作問者 : testestest / テスター : tko919
お気に入りにしたユーザー ProblemId : 11650 / 自分の提出
問題文最終更新日: 2024-11-26 16:25:56
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
Advent Calendar Contest 2024 (順位表) の他の問題:

Problem Statement

Among right triangles whose 3 side lengths are all integers, find the number of those with perimeter at most $N$.

Input

$N$

$N$ is an integer between $1$ and $10^{12}$, inclusive.

There are 26 test cases excluding the samples, and test cases 1 through 14 satisfy $N\leq 10^7$ (about ★2.5).

Output

Output the answer.

Sample

Sample 1
Input
30
Output
3

The 3 right triangles with side lengths $(3,4,5),(6,8,10),(5,12,13)$ qualify.

Sample 2
Input
10000000
Output
9706567

Sample 3
Input
1000000000000
Output
1779214833461

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。