#K61847. Perfect Square Checker
Perfect Square Checker
Perfect Square Checker
You are given a single integer N. Your task is to determine whether N is a perfect square.
If N is a perfect square, output its integer square root and the boolean value True
. Otherwise, output the smallest integer greater than the square root (i.e. the ceiling value) and the boolean value False
.
Mathematically, if N is a perfect square, then there exists an integer x such that:
$x^2 = N$
Otherwise, if:
$x^2 < N < (x+1)^2$, then output x+1 and False
.
inputFormat
The input consists of a single integer N (1 ≤ N ≤ 109) given via standard input (stdin).
outputFormat
Output two values separated by a space: the computed integer (the square root if N is a perfect square, or the ceiling of the square root otherwise) and a boolean value (True
/False
) indicating whether N is a perfect square.
16
4 True