Problems > The Infinite Digit String

The Infinite Digit String

Difficulty: 1400 2000 ms 128 MB

math

All positive integers are written in a row: 123456789101112131415... Print the K-th digit (1-indexed).

Input: one integer K.

Output: the K-th digit of the infinite string.

Constraints:

  • 1 ≤ K ≤ 1018

Sample Tests

Input 1
11
Output 1
0
Input 2
3
Output 2
3

Read the Editorial

Discussion (opens after you solve — no spoilers before)

No comments yet.

Submit Your Solution

Log in or create a free account to run and submit code.