#28Medium
Rounding
Time: 1 s · Memory: 256 MB
- Arithmetic
Statement
You are given a real number . Round it to the nearest integer. If lies exactly halfway between two integers (fractional part ), round away from zero: , , .
Input format
A single number () with at most 2 digits after the decimal point; the point may be absent (for example, 7).
Output format
A single integer — rounded.
Examples
Input
2.5
Output
3
Input
-2.5
Output
-3
Note
Python's round() uses a different rule: it rounds a halfway value to the even neighbour — round(2.5) , round(0.5) . That is wrong for this problem. C++ round() and Go math.Round follow exactly this problem's rule. You can also do it by hand: take the integer part of and restore the sign of .
