簡単 0件解決済み 正答率0%

Palindrome Number

Check whether a number reads the same backwards.

Decide whether the decimal digits of n read the same forwards and backwards. Negative numbers are never palindromes because of the minus sign.

Implement is_palindrome_number(n).

Input

n: The number to check.

Output

Return true for a palindromic number, otherwise false.

制約

-10¹⁸ ≤ n ≤ 10¹⁸

例

例 1
入力:
n = 12321

期待される出力:
expected = True
入力:
long long n = 12321;

期待される出力:
bool expected = true;
入力:
long n = 12321;

期待される出力:
bool expected = true;

解説

12321 reversed is 12321.

例 2
入力:
n = -121

期待される出力:
expected = False
入力:
long long n = -121;

期待される出力:
bool expected = false;
入力:
long n = -121;

期待される出力:
bool expected = false;

解説

The minus sign makes "-121" differ from "121-".

参考資料

この課題はCodeUtility用に調整されています。上記の説明と制約に従ってください。

他の人の解答から学ぶ

コミュニティの解答

まだ公開された解答がありません。この課題を解いて最初の解答を共有しましょう。