0100. Small Number Inversion
Input file name: | smallnum.in |
Output file name: | smallnum.out |
Time limit: | 2 s |
Memory limit: | 64 megabytes |
You are given a real number R such as 1 ≤ R<2. Your task is to invert it and output the result with exactly n digits after decimal point.
Input file
The input file contains two numbers separated by a single space: n (1 ≤ n ≤ 10000) and R which may have up to ten thousand digits after decimal point.
Output file
Output inverse number to R with exactly n digits after decimal point. Standard rounding rules apply. That is, if the exact n+1-th digit after decimal point is 4 or smaller, the n-th digit in output is rounded downards; otherwise upwards.
Examples:
smallnum.in | smallnum.out |
---|---|
1 1.25 | 0.8 |
Source: Petrozavodsk Summer 2003. Opening Contest, Friday, August 22
Author: Andrew Lopatin, Nick Durov
Discuss Submit a solution