No.864 Four Arithmetic Operations
問題文最終更新日: 2019-08-16 21:14:42
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 220
(順位表)
の他の問題:
Problem Statement
Output the number of integer tuples $(a, b, c, d)$ that satisfy the following conditions.
- $a, b, c, d$ are all integers between $1$ and $N$, inclusive
- $ab + bc + cd + da = K$
Constraints
All input data satisfy the following constraints.
- $N$ is an integer between $1$ and $1 \ 000 \ 000 \ 000 \ 000$, inclusive
- $K$ is an integer between $1$ and $1 \ 000 \ 000 \ 000 \ 000$, inclusive
Input
$N$ $K$
Output
Output the number of tuples $(a, b, c, d)$ that satisfy the conditions.
Print a newline at the end.
Sample
Sample 1
Input
3 6
Output
4
The $4$ combinations $(a, b, c, d) = (1, 1, 1, 2), (1, 1, 2, 1), (1, 2, 1, 1), (2, 1, 1, 1)$ satisfy the conditions.
Sample 2
Input
3 15
Output
8
The $8$ combinations $(a, b, c, d) = (1, 2, 2, 3), (1, 3, 2, 2), (2, 1, 3, 2), (2, 2, 1, 3), (2, 2, 3, 1), (2, 3, 1, 2), (3, 1, 2, 2), (3, 2, 2, 1)$ satisfy the conditions.
Sample 3
Input
16 189
Output
264
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
e869120
tatyam