Non-Prime 2
Time limit0.5sMemory limit1024 MB
Given a prime k with 0 < k < 1 and up to eight decimal digits, output a fraction p/q with p and q at most 10^9 that approximates k.
- Level
Easy2 of 10
- Topics
- Implementation, Math
- Solved
- No attempts yet
Problem
A member of the contest staff, a KSA student, recently overcame their fear of prime numbers but can no longer tell one prime from another. To restore KSA's honor, read a prime and find any fraction that represents .
and are positive integers at most . The answer is correct if the absolute error or the relative error between and is at most .
Input
The first line contains the prime .
Output
On the first line, print YES if a fraction satisfying the condition exists, and NO otherwise.
If such a fraction exists, print two integers and separated by a space on the second line.
If there are multiple correct answers, you may print any of them.
Constraints
- is given with at most eight digits after the decimal point.
- The decimal has no unnecessary trailing .
Hint
The absolute error is the difference between the true value and the approximation. The relative error is the absolute error divided by the true value. In this problem, the true value is , and the approximation is .