#K88872. Special Sequence Checker
Special Sequence Checker
Special Sequence Checker
You are given a series of integers. A series is considered special if for every element \(a_i\) (except the last one), the following condition holds:
\(a_i = (a_{i+1})^2\)
For example, the series [16, 4, 2]
is special because \(16 = 4^2\) and \(4 = 2^2\). On the other hand, the series [25, 5, 1, 1]
is not special since \(5^2 = 25\) holds, but \(5 \neq 1^2\).
Your task is to determine whether each given series is special. The input contains several test cases and for each test case you need to output either "TRUE" if the series is special or "FALSE" otherwise.
inputFormat
The input is read from standard input (stdin
) and is formatted as follows:
- The first line contains an integer T representing the number of test cases.
- Each of the following T lines contains a sequence of space-separated integers representing one test case.
outputFormat
For each test case, output a single line on standard output (stdout
) containing either "TRUE" if the series is special or "FALSE" otherwise.
4
16 4 2
25 5 1 1
81 9 3
1 1
TRUE
FALSE
TRUE
TRUE
</p>