题解 | #自守数#
自守数
https://www.nowcoder.com/practice/88ddd31618f04514ae3a689e83f3ab8e
n = int(input())
re = 0
for i in range(n+1):
tmp1 = str(i)
tmp2 = str(i ** 2)
if tmp2[-len(tmp1):] == tmp1:
re += 1
print(re)
自守数
https://www.nowcoder.com/practice/88ddd31618f04514ae3a689e83f3ab8e
n = int(input())
re = 0
for i in range(n+1):
tmp1 = str(i)
tmp2 = str(i ** 2)
if tmp2[-len(tmp1):] == tmp1:
re += 1
print(re)
相关推荐