AtCoder Beginner Contest 165
D
Floor Function
AtCoder
⌀ 600
原题
← CE →
翻译中…

Problem Statement

翻译中…

Given are integers $A$, $B$, and $N$.

翻译中…

Find the maximum possible value of $floor(Ax/B) - A × floor(x/B)$ for a non-negative integer $x$ not greater than $N$.

翻译中…

Here $floor(t)$ denotes the greatest integer not greater than the real number $t$.

翻译中…

Constraints

翻译中…
  • $1 ≤ A ≤ 10^{6}$
  • $1 ≤ B ≤ 10^{12}$
  • $1 ≤ N ≤ 10^{12}$
  • All values in input are integers.
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

A B N

翻译中…

Output

翻译中…

Print the maximum possible value of $floor(Ax/B) - A × floor(x/B)$ for a non-negative integer $x$ not greater than $N$, as an integer.

翻译中…

样例

Input #1
5 7 4
Output #1
2
When $x=3$, $floor(Ax/B)-A×floor(x/B) = floor(15/7) - 5×floor(3/7) = 2$. This is the maximum value possible.
Input #2
11 10 9
Output #2
9
题目信息
题号
abc165_d
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。