Degrees, radians, gradians
Time limit1sMemory limit512 MB
Given an angle written with six decimals in degrees, radians, or gradians, recover the integer degree value and the unit, or report that it is ambiguous.
- Level
Medium6 of 10
- Topics
- Math, Implementation, Brute force, Number theory
- Solved
- No attempts yet
Problem
In math class, Alice thought of an angle measured by an integer degrees (from 0 to 359) and passed Bob the value of the angle written in one of three common units: degrees, radians, or gradians (a metric unit of angle measurement; a right angle contains 100 gradians). The notation has exactly 6 digits after the decimal point and differs from the exact value by less than .
Bob asked you to help recover the value of and to determine which units Alice used for the notation.
Input
The first line of the input contains a single integer , the number of test cases (). Each of the following lines contains a single real number written with exactly 6 digits after the decimal point: the result of Alice's calculation.
It is guaranteed that the numbers were obtained in the manner described in the problem statement.
Output
If the value of and the units used cannot be recovered uniquely, output . Otherwise output two integers: the original value and the type of units, where is degrees, is radians, and is gradians.
Hint
In the first example, Bob can recover , but he cannot get any information about the units, so the answer is .