#PCBBAY0000031. Quan sát ties-to-even với số .5 (Observe Half-to-Even Rounding)
Quan sát ties-to-even với số .5 (Observe Half-to-Even Rounding)
Observe Half-to-Even Rounding
Version: Phuoc Hung OJ Extended
Problem Statement
Given a real number , demonstrate Python 3 ties-to-even rounding by computing round(x) and printing the resulting integer. For exactly representable half-integer inputs, select the even one of the two equidistant integers, including for negative inputs.
Input
The only line contains a real number .
Output
Print one integer: round(x) under ties-to-even rounding.
Subtasks
- Subtask 1 (100 points): .
Examples
Example 1
Input
2.5
Output
2
Explanation. For input 2.5, round(x) produces 2. An exact halfway case is resolved by selecting the even candidate.
Example 2
Input
3.5
Output
4
Explanation. For input 3.5, round(x) produces 4. An exact halfway case is resolved by selecting the even candidate.
Example 3
Input
-2.5
Output
-2
Explanation. For input -2.5, round(x) produces -2. An exact halfway case is resolved by selecting the even candidate.