#K69827. Integer Palindrome Check
Integer Palindrome Check
Integer Palindrome Check
Given an integer n, determine whether it is a palindrome without converting it to a string. An integer is said to be a palindrome if it reads the same backwards as forwards. For negative integers, output "No", since the negative sign is not symmetric.
The challenge is to check the condition using arithmetic operations only. The procedure should compute the reverse of the number and compare it with the original number.
In mathematical terms, if \( n \) is the input integer and \( rev(n) \) is its reverse computed by the recurrence \[ rev = rev \times 10 + (n \mod 10), \] then the integer is a palindrome if and only if \( n = rev(n) \) (provided \( n \geq 0 \)).
inputFormat
The input consists of a single integer n provided via standard input.
Constraints: \( -10^9 \leq n \leq 10^9 \).
outputFormat
Output a single line containing either Yes
if the integer is a palindrome, or No
if it is not, printed to standard output.
121
Yes