python 每隔10个数计算2次(个位为5、6的数)
自守数
http://www.nowcoder.com/questionTerminal/88ddd31618f04514ae3a689e83f3ab8e
while True: try: n = int(input()) if n == 0: print(1) elif n == 1: print(2) else:#n >= 2 res = 2 i = 5#除了0,1,只有个位数是 5 或 6 才有可能是自守数 while i <= n: if str(i**2).endswith(str(i)): res += 1 if i+1<= n and str((i+1)**2).endswith(str(i+1)): res += 1 i += 10 print(res) except: break