[BOJ 7116] Series
View as PDFAll the natural numbers from n to m (inclusively) are written in a row without separating symbols, thus creating a series of decimal digits.</p>
For example, if n=98 and m=102, this series is 9899100101102.
Then all the digits are sorted in a non-increasing order - first the greatest digits, then the next greatest, etc.
For the example above this sorted series is 9998211110000.
For the values of natural numbers n,m and k given in the input your task is to compute, which digit will be in the k-th position of the sorted series.
입력 형식
The values of three natural numbers n (0 < n < 109), m (0 < m < 109, m ≥ n) and k (0 < k < 109) are input from the keyboard.
출력 형식
The digit at the k-th position of the sorted series must be output on the screen. If length of the series is less than k, a single word “NAV” must be output on the screen.
예제 입력 1
98 102 4
예제 출력 1
8
예제 입력 2
9999 9999 5
예제 출력 2
NAV
Comments