n = int(input())
s = ""
for i in range(1, n + 1):
    s += str(i)
print(s[n - 1])

不用枚举,时间复杂度O(n)