#K78942. Pyramid Blocks Formation
Pyramid Blocks Formation
Pyramid Blocks Formation
Given an integer \(N\) representing the total number of blocks, determine if it is possible to construct a pyramid such that every level uses one more block than the previous level. The total number of blocks required for a pyramid of height \(k\) is given by the formula: $$\frac{k(k+1)}{2} = N.$$
Your task is to decide whether there exists a positive integer \(k\) satisfying this equation. If such a \(k\) exists, output YES
; otherwise, output NO
.
inputFormat
The input consists of a single line containing an integer \(N\) (\(1 \leq N \leq 10^9\)), which represents the available number of blocks.
outputFormat
Output a single line containing YES
if it is possible to construct a pyramid with exactly \(N\) blocks, or NO
otherwise.
6
YES
</p>