题解 | #回文对称数#
回文对称数
https://www.nowcoder.com/practice/5b143af8328f4e42adf5e10397ae44ef
n=int(input())
for i in range(1,n+1):
if len(str(i))==1:
print(i)
elif len(str(i))==2 or len(str(i))==3:
if str(i)[0]==str(i)[-1]:
print(i)
elif len(str(i))==4 or len(str(i))==5:
if str(i)[0] == str(i)[-1] and str(i)[1] == str(i)[-2]:
print(i)
else:
if str(i)[0] == str(i)[-1] and str(i)[1] == str(i)[-2] and str(i)[2] == str(i)[-3]:
print(i)
查看8道真题和解析
