#K59842. Restore Array from Squared Values
Restore Array from Squared Values
Restore Array from Squared Values
In this problem, you are given an array ( b ) of size ( n ) where each element ( b_i ) is the square of a corresponding element ( a_i ), i.e., ( b_i = a_i^2 ). Your task is to restore the original array ( a ) by taking the positive square root of each element in ( b ). The input is provided via standard input and the result must be printed on standard output.
For example, if the input array is [1, 4, 9, 16], then the original array is [1, 2, 3, 4].
inputFormat
The first line contains a single integer ( n ), the number of elements in the array. The second line contains ( n ) space-separated integers, representing the values of ( b ) where ( b_i = a_i^2 ).
outputFormat
Output the restored array ( a ) with ( n ) integers in one line separated by a single space, where each integer is the square root of the corresponding element in ( b ).## sample
4
1 4 9 16
1 2 3 4