#C1624. Pyramid Construction Verification
Pyramid Construction Verification
Pyramid Construction Verification
You are given a positive integer \( n \) representing the total number of blocks available. A pyramid is constructed by placing blocks in successive rows such that the first row has 1 block, the second row has 2 blocks, the third row 3 blocks, and so on. In other words, a pyramid of height \( k \) requires exactly \( T_k = \frac{k(k+1)}{2} \) blocks. Your task is to determine if it is possible to construct a perfect pyramid using exactly \( n \) blocks. If it is possible, output 1; otherwise, output 0.
Note: For example, if \( n = 3 \) then a pyramid of height 2 can be formed (since \( 1+2=3 \)), so the answer is 1. If \( n = 4 \), no integer \( k \) satisfies \( \frac{k(k+1)}{2} = 4 \), so the answer is 0.
inputFormat
The input consists of a single integer \( n \) (\(1 \leq n \leq 10^{12}\)) given via standard input.
outputFormat
Output a single integer: 1 if it is possible to build a perfect pyramid with exactly \( n \) blocks, or 0 otherwise.
## sample1
1