题解 | #自守数#
自守数
http://www.nowcoder.com/practice/88ddd31618f04514ae3a689e83f3ab8e
while True:
try:
n = int(input())
ans = 0
for i in range(0,n+1):
s = i*i
list1 = list(str(s))
list2 = list(str(i))
v = len(list1)
p = len(list2)
if i==s or list2 == list1[v-p:]:
ans += 1
print(ans)
except:
break
try:
n = int(input())
ans = 0
for i in range(0,n+1):
s = i*i
list1 = list(str(s))
list2 = list(str(i))
v = len(list1)
p = len(list2)
if i==s or list2 == list1[v-p:]:
ans += 1
print(ans)
except:
break