#PCBBAY0000026. Làm tròn đến số nguyên gần nhất (Round to the Nearest Integer)
Làm tròn đến số nguyên gần nhất (Round to the Nearest Integer)
Round to the Nearest Integer
Version: Phuoc Hung OJ Extended
Problem Statement
Given a real number , round it to the nearest integer under Python 3 round(x). If lies exactly halfway between consecutive integers, choose the even integer (ties-to-even). Print an integer, not a fixed-point representation.
Input
The only line contains a real number .
Output
Print one integer: the result of round(x).
Subtasks
- Subtask 1 (100 points): .
Examples
Example 1
Input
2.4
Output
2
Explanation. For input 2.4, round(x) produces 2. An exact halfway case is resolved by selecting the even candidate.
Example 2
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 3
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.