#P8652. [蓝桥杯 2017 国 C] 小数第 n 位

[蓝桥杯 2017 国 C] 小数第 n 位

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 00'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 nn-th digit after the decimal point.

Input Format

One line with three integers aa, bb, and nn, separated by spaces. aa is the dividend, bb is the divisor, and nn is the position after the decimal point to query (0<a,b,n<1090<a,b,n<10^9).

Output Format

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

1 8 1
125
1 8 3
500
282866 999000 6
914

Hint

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

Translated by ChatGPT 5