a110: 回文數字
Tags :
Accepted rate : 110人/137人 ( 80% ) [非即時]
評分方式:
Strictly

最近更新 : 2022-08-18 02:03

Content

Determine whether an integer is a "palindrome". An integer is a palindrome when it reads the same backward as forward.

Input

a integer num

-30000<=num<=30000

 

Output

True or False

Sample Input #1
121
Sample Output #1
True
Sample Input #2
-121
Sample Output #2
True
Sample Input #3
1345
Sample Output #3
False
測資資訊:
記憶體限制: 64 MB
不公開 測資點#0 (33%): 1.0s , <1K
不公開 測資點#1 (33%): 1.0s , <1K
不公開 測資點#2 (34%): 1.0s , <1K
Hint :

You can simply read the input() as string (no "integer conversion" is needed this time) and then verify the digit (from both directions, left and right). Note that you may need to handle the "negative" symbol by yourself.

>> thislist = ["apple", "banana", "cherry"]
>> print(thislist[::-1])

Tags:
出處:
[管理者:
kichan@g.pui... (陳嘉賢CHAN KA IN)
]


ID User Problem Subject Hit Post Date
沒有發現任何「解題報告」