题解 | #自守数#
自守数
https://www.nowcoder.com/practice/88ddd31618f04514ae3a689e83f3ab8e
n=int(input()) cnt=0 for i in range(n+1): square=list(str(i**2)) l=len(str(i)) tail=int(''.join(square[-l:])) #print(square,tail) if tail==i: cnt += 1 print(cnt)
自守数
https://www.nowcoder.com/practice/88ddd31618f04514ae3a689e83f3ab8e
n=int(input()) cnt=0 for i in range(n+1): square=list(str(i**2)) l=len(str(i)) tail=int(''.join(square[-l:])) #print(square,tail) if tail==i: cnt += 1 print(cnt)
相关推荐