codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

1177A.md (779B)


      1 Source: https://codeforces.com/problemset/problem/1177/A
      2 
      3 A. Digits Sequence (Easy Edition)
      4 
      5 time limit per test
      6 
      7 1 second
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...
     22 
     23 Your task is to print the $k$-th digit of this sequence.
     24 
     25 Input
     26 
     27 The first and only line contains integer $k$ ($1 \le k \le 10000$) — the position to process ($1$-based index).
     28 
     29 Output
     30 
     31 Print the $k$-th digit of the resulting infinite sequence.
     32 
     33 Examples
     34 
     35 Input
     36 
     37 ```
     38 7
     39 ```
     40 
     41 Output
     42 
     43 ```
     44 7
     45 ```
     46 
     47 Input
     48 
     49 ```
     50 21
     51 ```
     52 
     53 Output
     54 
     55 ```
     56 5
     57 ```