0100. Small Number Inversion

Имя входного файла: smallnum.in
Имя выходного файла: smallnum.out
Ограничение по времени: 2 s
Ограничение по памяти: 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.insmallnum.out
1 1.250.8


Источник: Petrozavodsk Summer 2003. Opening Contest, Friday, August 22
Автор: Andrew Lopatin, Nick Durov

Обсудить       Отправить решение



Версия для печати