题解 | 回文日期
回文日期
https://www.nowcoder.com/practice/0372242deac541d0b578cc6563395681
import sys
import datetime
month = [0,31,29,31,30,31,30,31,31,30,31,30,31]
start,end= map(int,sys.stdin.read().splitlines())
count=0
#只用管m和d就可以,y由m,d对称过来就行
for m in range(1,13):
for d in range(1,month[m]+1):
y = d%10*1000+d//10*100+m%10*10+m//10
cur=y*10000+m*100+d
if start<=cur<=end:
count+=1
if y%4==0 and y%100!=0 or y%400==0:
month[2]=28
else:
month[2]=29
print(count)
