P8652 [Lanqiao Cup 2017 National C] The $n$-th Digit After the Decimal Point

Description

We know that when dividing integers, sometimes the result is a terminating decimal, and sometimes it is an infinitely repeating decimal. If we append infinitely many $0$'s to the end of a terminating decimal, then they all have a unified form. Under the convention above, the task is: given an integer division, find the 3-digit number consisting of the three digits starting from the $n$-th digit after the decimal point.

Input Format

One line with three integers $a$, $b$, and $n$, separated by spaces. $a$ is the dividend, $b$ is the divisor, and $n$ is the position after the decimal point to query ($0

Output Format

Output one line with exactly 3 digits, representing the three digits starting from the $n$-th digit after the decimal point in the decimal expansion of $\frac{a}{b}$.

Explanation/Hint

Time limit: 1 second, 256M. The 8th Lanqiao Cup National Final in 2017. Translated by ChatGPT 5