#ABC165D. Floor Function

Floor Function

题目描述

Given are integers AA, BB, and NN.

Find the maximum possible value of floor(Ax/B)−Afloor(x/B)floor(Ax/B) - A floor(x/B) for a non-negative integer xx not greater than NN.

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

给出整数 AA 、 BB 和 NN 。

求不大于 NN 的非负整数 xx 的最大可能值 floor(Ax/B)−Afloor(x/B)floor(Ax/B) - A floor(x/B) 。

这里的 floor(t)floor(t) 表示不大于实数 tt 的最大整数。

输入格式

输入内容按以下格式标准输入:

AA BB NN

输出格式

以整数形式打印非负整数 xx 不大于 NN 的 floor(Ax/B)−Afloor(x/B)floor(Ax/B) - A floor(x/B) 的最大可能值。

样例 #1

样例输入 #1

5 7 4

样例输出 #1

2

样例 #2

样例输入 #2

11 10 9

样例输出 #2

9

说明

数据规模与约定

  • 1≤A≤1061 ≤ A ≤ 10^{6}
  • 1≤B≤10121 ≤ B ≤ 10^{12}
  • 1≤N≤10121 ≤ N ≤ 10^{12}
  • 所有输入值均为整数。

样例 11 解释

当 x=3x=3 , $floor(Ax/B)-Afloor(x/B) = floor(15/7) - 5floor(3/7) = 2$ 时。这是可能的最大值。