题解 | 自守数
while True:
try:
num = int(input())
lstA,lstB = [],[]
count = 0
for i in range(0,num+1):
lstA = list(str(i))
lstB = list(str(i**2))
if lstA == lstB[-len(lstA):]:
count +=1
print(count)
except:
break
查看8道真题和解析