#PCBBAY0000054. Phân số chính xác của float (Exact Fraction of a Float)
Phân số chính xác của float (Exact Fraction of a Float)
Exact Fraction of a Float
Version: Phuoc Hung OJ Extended
Problem Statement
Given a real number parsed as a Python 3 float, find integers and with exactly for the stored binary value, in lowest terms. Do not use the ideal decimal fraction of the input text. Match Python x.as_integer_ratio().
Input
The only line contains finite real number , parsed as Python 3 float.
Output
Print integers and on one line, separated by a space: numerator first, positive denominator second. The fraction must be reduced.
Subtasks
- Subtask 1 (100 points): is a finite Python
float; the denominator must be positive.
Examples
Example 1
Input
0.5
Output
1 2
Explanation. The value is represented exactly; numerator and denominator are already coprime.
Example 2
Input
0.1
Output
3602879701896397 36028797018963968
Explanation. Decimal has no finite binary representation. The displayed fraction exactly represents the stored float, rather than the ideal value .
Example 3
Input
1.25
Output
5 4
Explanation. Since and and are coprime, the output is 5 4.