FUCT_IF_SQRT - Square root
Calculate the square root of a number, or determine that the square root doesn't exist.
Input
The first line of the input consist of a single integer number t which determines the number of tests.
In each of next t lines there is a single number n.
Constraints
- 0 < t ≤ 1 000
- 0 ≤ n ≤ 1 000 000
Output
For each number n print out the square root of n. Do not print trailing zeros, or the decimal point if there are no decimal places printed. See examples for clarification.
Separate your answers with a new line character.
Example
Input: 7 4 7 0 2 -9 1 -3 Output: 2 2.645751 0 1.414214 invalid 1 invalid
hide comments
albert_praveen:
2023-08-07 18:51:12
If you are using java then just for getting a perfect square value like instead of 2.0 u can get 2 by using (sqrted value-Math.floor(sqrted value)) if the value is equal to zero then it is a perfect square value |
|
Mostafa 36a2:
2022-09-23 00:14:41
Be aware to print the result without decimal points if the number was a perfect square.
|
Added by: | khanhvh |
Date: | 2018-06-18 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |
Resource: | FPTU Can Tho |