Python题解 | #自守数#
自守数
https://www.nowcoder.com/practice/88ddd31618f04514ae3a689e83f3ab8e
import sys while True: try: n = int(input()) ans = 1 for i in range(1, n + 1): if i % 10 == 1 or i % 10 == 5 or i % 10 == 6: a = str(i) b = str(i * i) if b[-len(a):] == a: ans += 1 print(ans) except: break