No.800 Four Square Theorem
レベル : / 実行時間制限 : 1ケース 2.000秒 / メモリ制限
: 512 MB / 標準ジャッジ問題
タグ : / 解いたユーザー数 398
作問者 :
tempura_pp
/ テスター :
heno239
タグ : / 解いたユーザー数 398
作問者 :
tempura_pp
/ テスター :
heno239
問題文最終更新日: 2019-03-18 13:31:13
English (AI translation)
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
yukicoder contest 208
(順位表)
の他の問題:
Problem Statement
You are given integers $N,\ D$. Find the number of tuples of positive integers $(x,\ y,\ z, w)$ that satisfy both of the following two conditions.
- $x,\ y,\ z,\ w$ are all integers between 1 and $N$, inclusive
- $x^2+y^2+z^2=w^2+D$
Input
$N\ D$
- $1\le N\le 2000$
- $0\le D\le 10^6$
- All inputs are integers
Output
Output the number of tuples of integers satisfying the conditions on one line.
Sample
Sample 1
Input
3 2
Output
7
The following 7 tuples.
$(x,\ y,\ z,\ w)$=(1, 1, 1, 1), (1, 1, 2, 2), (1, 1, 3, 3), (1, 2, 1, 2), (1, 3, 1, 3), (2, 1, 1, 2), (3, 1, 1, 3)
Sample 2
Input
7 100
Output
6
Sample 3
Input
1500 1000000
Output
1911906
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。