#PCBBAY0000009. Hai số nguyên liên tiếp sau khi chuyển float (Adjacent Integers Converted to Float)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Hai số nguyên liên tiếp sau khi chuyển float (Adjacent Integers Converted to Float)
Adjacent Integers Converted to Float
Version: Phuoc Hung OJ Extended
Problem Statement
Given a nonnegative integer , independently convert and to Python 3 float and determine whether the converted values are equal. Binary floating-point numbers have limited precision, so consecutive sufficiently large integers may map to the same value. Do not compare the original integers directly.
Input
The only line contains a nonnegative integer .
Output
Print exactly True if float(n) equals float(n + 1), otherwise False.
Subtasks
- Subtask 1 (100 points): .
Examples
Example 1
Input
9007199254740991
Output
False
Explanation. The converted values are 9007199254740991.0 and 9007199254740992.0 respectively. Comparing these two float values gives False.
Example 2
Input
9007199254740992
Output
True
Explanation. The converted values are 9007199254740992.0 and 9007199254740992.0 respectively. Comparing these two float values gives True.
Example 3
Input
9007199254740993
Output
False
Explanation. The converted values are 9007199254740992.0 and 9007199254740994.0 respectively. Comparing these two float values gives False.