Python 代码
class Solution(object):
def digitAtIndex(self, n):
i = 1; s = 9
while n > s * i:
n -= s * i
s *= 10
i += 1
res = 10 ** (i - 1) + n / i - 1
if n % i == 0:
res = str(res)[-1]
else:
res = str(res + 1)[n % i - 1]
return res