#P11919. Counting Distinct Rectangular Tanks
Counting Distinct Rectangular Tanks
Counting Distinct Rectangular Tanks
We are given a rectangular water tank with a base of size \(a \times b\) and height \(h\), where \(a\), \(b\), and \(h\) are positive integers. The length of the space diagonal of the tank is given by \(\sqrt{a^2+b^2+h^2}\). A tank is considered valid if:
- \(\sqrt{a^2+b^2+h^2}\) is an integer, and
- \(\sqrt{a^2+b^2+h^2} \le n\).
Two tanks \((a_1, b_1, h_1)\) and \((a_2, b_2, h_2)\) are considered essentially different if and only if \(\{a_1, b_1\} \neq \{a_2, b_2\}\) or \(h_1 \neq h_2\).
Your task is to count the number of essentially different valid tanks.
inputFormat
The input consists of a single integer \(n\) representing the maximum allowed integer for the diagonal \(\sqrt{a^2+b^2+h^2}\).
\(1 \le n \le 100\) (typically, \(n\) will be small enough for a simple O(n^3) solution to work).
outputFormat
Output a single integer: the number of essentially different valid tanks.
sample
3
1