公式

B - Palindrome with leading zeros 解説 by en_translator


Since \(N\) has at most \(10\) digits, we have to consider at most \(9\) zeros to prepend before \(N\). Thus, it is sufficient to check if it forms a palindrome after prepending \(0\) to \(9\) zeros respectively.

Sample Code (Python)

S=input()

for i in range(10):
	T = "0"*i + S
	if T==T[::-1]:
		print("Yes")
		exit()

print("No")

投稿日時:
最終更新: