题解 | 自守数
自守数
https://www.nowcoder.com/practice/88ddd31618f04514ae3a689e83f3ab8e
def get_count(num): count = 0 # 自守数的个数 for n in range(num+1): np = pow(n,2) length = len(str(n)) if int(str(np)[-length:]) == n: # 自守数的条件 count += 1 return count while True: try: n = int(input()) print(get_count(n)) except: break