Problem:


Score : 400 points

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.

Sample Input 1

5 7 4

Sample 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.

Sample Input 2

11 10 9

Sample Output 2

9



Sample input:
5 7 4


Sample output:
2

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
a,b,n=mii()

chk=0
if n>=b:
    chk=b-1
else:
    chk=n
print(floor(a*chk/b))

Submission status: Accepted

Solution code:
#! python3

a, b, n = map(int, input().split(' '))

if n >= b:
    n = b - 1

print((a * n // b) - a * (n // b))

Submission status: Accepted

Solution code:
a, b, n = map(int, input().split())

if n >= b - 1:
    ret = (a * (b - 1)) // b
else:
    ret = (a * n) // b - a * (n // b)

print(ret)

Submission status: Accepted

Solution code:
A, B, N = map(int, input().split())


def f(x):
    return A * x // B - A * (x // B)


if N >= B:
    print(f(B - 1))
else:
    print(f(N))

Submission status: Accepted

Solution code:
a,b,n = (int(i) for i in input().split())
ans = 0
if n >= b:
  ans = a*(b-1)//b
else:
  ans = a*(n)//b
print(ans)

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    a, b, n = list(map(int, readline().split()))

    x = min(b - 1, n)

    ans = int(a*x/b)

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    def f(a,b,x):
        return a*x//b-a*(x//b)

    a,b,n=MI()
    x=min(b-1,n)
    print(f(a,b,x))

main()

Submission status: Accepted

Solution code:
A, B, N = map(int, input().split())


if N >= B:
    r = B - 1
else:
    r = N
ans = A * r // B

print(ans)

Submission status: Accepted

Solution code:
a,b,n = map(int, input().split())
res=0
if b > n:
    res = int(a*n/b) -a*int(n/b)
else:
    res = int(a*(b-1)/b) - a*int((b-1)/b)
print(res)

Submission status: Accepted

Solution code:
A, B, N = map(int, input().split())
x = min(B-1, N)
print(A*x//B - A*(x//B))

Submission status: Accepted

Solution code:
import math

A,B,N=map(int,input().split())

if N<B-1:
    print(math.floor((A*N)/B))
else:
    print(math.floor(A*(B-1)/B))

Submission status: Accepted

Solution code:
A, B, N = [int(x) for x in input().split()]

x = min(B - 1, N)
print( (A * x // B) - A * (x // B) )

Submission status: Accepted

Solution code:
from math import floor
a, b, n = map(int, input().split())
x = min(n, b-1)
print(floor(a*x/b) - a * floor(x/b))

Submission status: Accepted

Solution code:
A, B, N = map(int, input().split())
c = 0
x = B-1
if x <= N:
    ans = (A*x) // B - A * (x // B)
else:
    ans = (A*N) // B - A * (N // B)
print(ans)

Submission status: Accepted

Solution code:
inf = 10**15
mod = 10**9+7
a,b,n = map(int, input().split())
x = 0
if n >= b:
    x = b-1
else:
    x = n
print((x*a)//b)

Submission status: Accepted

Solution code:
def func(a,b,x):
    return ((a*x)/b)//1-a*((x/b)//1)

a,b,n = map(int,input().split())
x = min(b-1,n)

print(int(func(a,b,x)))

# tp = 0
# for i in range(1,n+1):
#     tpp = func(a,b,i)
#     if tpp > tp:
#         tp = tpp
# print(tp)

Submission status: Accepted

Solution code:
A,B,N = map(int,input().split())
c = min(B - 1,N)
print((A * c)//B)

Submission status: Accepted

Solution code:
import math

def func(A, B, x):
    return math.floor(A*x/B)-A*math.floor(x/B)

A, B, N = list(map(int, input().split()))

"""
i = 1
max_x = -9999999
max = -9999999
while (i <= N):
    ans =func(A, B, i) 
    if (ans > max):
        max = ans
        max_x = i
    i += 1

print(max)
"""

print(func(A, B, min(B-1, N)))

Submission status: Accepted

Solution code:
a,b,n = map(int,input().split())
x = max(1,min(b-1,n))
print(int(a*x/b)-a*int(x/b))

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    a,b,n=MI()
    x=min(n,b-1)
    if b==1:
        x=1
    print((a*x)//b - a*(x//b))

main()

Submission status: Accepted

Solution code:
a, b, n = map(int, input().split())

if b <= n:
    x = b-1
else:
    x = n

print(a*x//b - x//b*a)

Submission status: Accepted

Solution code:
a,b,n=map(int,input().split())
if n>=b:
    print(((b-1)*a)//b-a*((b-1)//b))
else:
    print(n*a//b-a*(n//b))

Submission status: Accepted

Solution code:
#author: raghav_0901
from math import *

mod = (10**9) + 7


def _in():
    return [int(x) for x in input().split(' ')]


if __name__ == "__main__":
    a, b, n = _in()
    x = b - 1
    if(n < b):
        x = n
    ans = ((a * x) // b) - (a * (x // b))
    print(ans)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10000000)
import math


def main():
    A, B, N = map(int, input().split())
    if B <= N:
        # x = B - 1
        print(A * (B - 1)// B)
    else:
        print((A * N) // B)



if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys


def input():
    return sys.stdin.readline().strip()


def main():
    A, B, N = map(int, input().split())
    if N >= B:
        print(A * (B - 1) // B)
    else:
        print(A * N // B)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
A,B,N = map(int, input().split())

if B-1 <= N:
    C = B-1
else:
    C = N
    
ans = (A*C)//B - A*(C//B)
print(ans)

Submission status: Accepted

Solution code:

a, b, n = map(int, input().split())
i = min(n, b-1)
print((a*i)//b - a*(i//b))

Submission status: Accepted

Solution code:
def main():
    a, b, n = map(int, input().split())
    if n >= b-1:
        x = b-1
    else:
        x = n
    print(a*x//b-a*(x//b))


main()

Submission status: Accepted

Solution code:
from math import floor

A, B, N = map(int, input().split())
x = min(B - 1, N)
print(floor(A * x / B) - A * floor(x / B))

Submission status: Accepted

Solution code:
from math import floor as f

a,b,n = map(int,input().split())
if b <= n+1:
	print(int(a+f(-a/b)))
else:
	print(int(f(a*n/b)-a*f(n/b)))

Submission status: Accepted

Solution code:
a, b, n = map(int, input().split())
if n < b:
	print(int((a*n)/b))
else:
	print(int((a*(b-1))/b))

Submission status: Accepted

Solution code:
a, b, n = map(int, input().split())
A = []
# for i in range(1, n+1):
#     A.append((a * i)//b - a * (i//b))
# print(max(A))

x = 0
if n > (b - 1):
    x = b - 1
else:
    x = n
print((a * x)//b - a * (x//b))

Submission status: Accepted

Solution code:
A,B,N=map(int,input().split())

x=min(N,B-1)

print(A*x//B-A*(x//B))

Submission status: Accepted

Solution code:
a, b, n = map(int, input().split())
if b-1 <= n:
    print((a*(b-1))//b-(a*((b-1)//b)))
else:
    print((a*n)//b-(a*(n//b)))

Submission status: Accepted

Solution code:
A, B, N = list(map(int, input().split()))
x = min(N, B-1)
ans = A*x//B
print(ans)

Submission status: Accepted

Solution code:
import math
a,b,n=map(int,input().split())
if b<=n+1:
    x=b-1
else:
    x=n
g=math.floor(a*x/b)
print(g)

Submission status: Accepted

Solution code:
a, b, n = map(int, input().split())
print(a * min((b - 1), n) // b)

Submission status: Accepted

Solution code:
A, B, N = map(int, input().split())
def calc(a, b, n):
    x = min(b-1, n)
    return a * x // b - a * (x // b)
print(calc(A, B, N))

Submission status: Accepted

Solution code:
a,b,n=map(int,input().split())
print((a*min(n,b-1))//b)

Submission status: Accepted

Solution code:
A, B, N = map(int, input().split())
if N >= B:
    print(int(A * (B-1)/B))
else:
    print(int(A * N / B))

Submission status: Accepted

Solution code:
a,b,n=map(int,input().split())

if n>=b-1:print(a//b*(b-1)+(a%b)*(b-1)//b)
else:print(a//b*(n)+(a%b)*(n)//b)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

A, B, N = mi()

if N >= B:
    print(A*(B-1)//B)
else:
    print(A*N//B)

Submission status: Accepted

Solution code:
def main():
    A, B, N = map(int, input().split())
    if N >= B:
        return (A*(B-1)//B) - (A*((B-1)//B))
    else:
        return (A*N//B) - (A*(N//B))
print(main())

Submission status: Accepted

Solution code:
import math
A, B, N = list(map(int, input().split()))

if B > N:
    print(math.floor(A * N / B))
else:
    print(math.floor(A * (B-1) / B))

Submission status: Accepted

Solution code:
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

a,b,n = mi()
if n >= (b-1):
    ans = int(a*(b-1)/b)
else:
    ans = int(a*n/b)
print(ans)

Submission status: Accepted

Solution code:
A, B, N = map(int, input().split())

if N >= B:
    print((A*(B-1))//B)
else:
    print((A*N)//B)

Submission status: Accepted

Solution code:
A, B, N = map(int, input().split())

if B == 1:
  ans = 0
  print(ans)
  quit()

x = min(N, B - 1)

ans = (A * x / B) // 1 + A * ((x / B) // 1)

print(int(ans))

Submission status: Accepted

Solution code:
a, b, n = map(int, input().split())
if n >= b:
    ans = a * (b-1) // b
else:
    ans = a * n // b
print(ans)

Submission status: Accepted

Solution code:
a,b,n=map(int,input().split())
import math 
ans=min(n,b-1)
print(math.floor(a*ans/b))

Submission status: Accepted

Solution code:
import sys
input=lambda: sys.stdin.readline().rstrip()
a,b,n=map(int,input().split())
print((a*min(b-1,n)//b))

Submission status: Accepted

Solution code:
A,B,N = list(map(int,input().split()))

s = min(N,B-1)

print((A*s)//B - A*(s//B))

Submission status: Accepted

Solution code:
import math
A,B,N = map(int, input().split())

if (B-1) <= N:
    print(math.floor((A*(B-1))/B) - A*math.floor((B-1)/B))
else:
    print(math.floor(A*N/B) - A*math.floor(N/B))

Submission status: Accepted

Solution code:
A,B,N = map(int,input().split())
x = min(N,B-1)
print(int(A*(x%B) / B))

Submission status: Accepted

Solution code:
def nasu(a, b, x):
  return (a * x) // b - (x // b) * x

A, B, N = list(map(int, input().split()))
if B == N:
  print(nasu(A, B, N - 1))
elif B > N:
  print(nasu(A, B, N))
else:
  print(nasu(A, B, B - 1))

Submission status: Accepted

Solution code:
s=list(map(int,input().split()))
a=s[2]%s[1]
d=s[2]//s[1]
if a==s[1]-1:
  b=int((s[0]*a)//s[1])
  c=int(a//s[1])*s[0]
  print(b-c)
else:
  if d==0:
    b=int((s[0]*a)//s[1])
    c=int(a//s[1])*s[0]
    print(b-c)
  else:
    a=s[2]-a-1
    b=int((s[0]*a)//s[1])
    c=int(a//s[1])*s[0]
    print(b-c)

Submission status: Accepted

Solution code:
[A,B,N] = list(map(int,input().split()))

X = min(B-1,N)

out = int(A*X/B) - A*int(X/B)
print(out)

Submission status: Accepted

Solution code:
a, b, n = [int(x) for x in input().split()]


def solve(n):
    return (a*n)//b - a*(n//b)


print(solve(min(n, b-1)))

Submission status: Accepted

Solution code:
A,B,N=map(int, input().split())
def f(n):
    return A*n//B-A*(n//B)
ans=f(N)
ans=max(ans,f(N//B*B))
x=N//B*B-1
if x>0:
    ans=max(ans,f(x))
print(ans)

Submission status: Accepted

Solution code:
from math import gcd

from math import factorial as f

from math import ceil,floor,sqrt


import bisect
import re
import heapq


from copy import deepcopy
import itertools

from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

yes = "Yes"
no = "No"

def main():
    a,b,n = mi()
    tmp = min(b-1,n)
    print((a*tmp)//b)



main()

Submission status: Accepted

Solution code:
import math
a,b,n = [int(i) for i in input().split()]

if n >= b - 1:
  x = b - 1
else:
  x = n
  
print(math.floor(a*x/b) - a * math.floor(x/b))

Submission status: Accepted

Solution code:
import math
# import numpy as np
# import queue
# import heapq


def main():
    print(solve())


def solve():
    A, B, N = map(int, input().split())

    x = min((B-1), N)
    v = math.floor(A * x / B)

    return v


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import math
a, b, n = map(int, input().split())
t = min(n, b-1)
print(math.floor(a*t/b)-math.floor(t/b)*a)

Submission status: Accepted

Solution code:
a, b, n = map(int, input().split())
x = min(n, b-1)
print((a*x)//b-a*(x//b))

Submission status: Accepted

Solution code:
import math

a,b,n = map(int,input().split())

if n >= b-1:
    print(math.floor(a*(b-1)/b))
else:
    print(math.floor(a*n/b) - a*math.floor(n/b))

Submission status: Accepted

Solution code:
a, b, n = map(int,input().split())
i = min(b-1, n)
print((a*i) // b - a * (i//b))

Submission status: Accepted

Solution code:
a,b,n = list(map(int,input().split()))
if b<=n:
    print(int(a*(b-1)/b))
else:
    print(int(a*n/b))

Submission status: Accepted

Solution code:
A, B, N = map(int, input().split())
ans = 0
if B <= N:
    ans = ((B-1)*A)//B
else:
    ans = (N*A)//B
print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

A, B, N = map(int, input().split())

if N >= B:
    x = B-1
else:
    x = N

print(A*x//B)

Submission status: Accepted

Solution code:
A, B, N = map(int, input().split())
alpha = A // B
beta = A % B
q = min(N, B - 1)

ans = alpha * q + (beta*q//B)
print(ans)

Submission status: Accepted

Solution code:
a,b,n = map(int,input().split())
ans = 0
if b-1 > n:
  print(a*n//b)
else:
  print(a*(b-1)//b)

Submission status: Accepted

Solution code:
a, b, n = map(int, input().split())

x = 0

if n >= b:
    x = b-1
else:
    x = n

ans = (a * x) // b

print(ans)

Submission status: Accepted

Solution code:
A,B,N = map(int,input().split())
if N > (B-2) :
    P = (A*(B-1))//B
else:
    P = (A*N)//B
print(P)

Submission status: Accepted

Solution code:
def F(A, B, X):
    p = (A * X) // B
    q = A * (X // B)
    return p - q


if __name__ == "__main__":
    A, B, N = map(int, input().split())
    # B周期、X％B=B-1のときに最大, 単調増加
    if N >= B - 1:
        ans = F(A, B, B - 1)
    else:
        ans = F(A, B, N)
    print(ans)

Submission status: Accepted

Solution code:
import math
a,b,n = map(int,input().split())

if n >= b - 1:
    print(int(math.floor(a*(b-1)/b)))
else:
    print(int(math.floor(a * n / b)))

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

A,B,N = map(int, read().split())
x = min(N, B-1)
print(A * x // B)

Submission status: Accepted

Solution code:
import math

a, b, n = map(int, input().split())

if n < b:
  ans = math.floor(a*n/b) - a*math.floor(n/b)
else:
  ans = math.floor(a*(b-1)/b) - a*math.floor((b-1)/b)
  
print(ans)

Submission status: Accepted

Solution code:
import random
import math
LI = lambda: list(map(int,input().split()))
MI = lambda: map(int,input().split())
yes = lambda: print("Yes")
no = lambda: print("No")
I = lambda: list(input())
J = lambda x: "".join(x)
II = lambda: int(input())
SI = lambda: input()
#---khan17---template
a,b,n = MI()
if n >= b:
	n = b-1
print(int(a*n/b)-a*int(n/b))

Submission status: Accepted

Solution code:
a , b , n = map(int,input().split())
if n >= b-1:
    print(a*(b-1)//b)
elif b-1 > n:
    print(a*n//b)

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

a,b,n = inpl()
x = min(b-1,n)
print(int((a*x)/b) - a*int(x/b))

Submission status: Accepted

Solution code:
A, B, N = map(int, input().split())
if B > N:
    x = N
else:
    x = B-1
print((A*x)//B - A*(x//B))

Submission status: Accepted

Solution code:
a,b,c=map(float,input().split())
x=min(b-1,c)
import math
print(int(math.floor(a*x/b)-a*math.floor(x/b)))

Submission status: Accepted

Solution code:
#!/usr/bin/env python
import os
import sys
from io import BytesIO, IOBase


def main():
    a,b,n=map(int,input().split())
    ans=0
    m=n
    ans=max(ans,(a*m)//b-a*(m//b))
    m=(n//b)*b-1
    m=max(m,0)
    # print(n,m)
    ans=max(ans,(a*m)//b-a*(m//b))
    print(ans)

# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
# endregion

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
a,b,n=map(int,input().split())
ans=a*n//b-a*(n//b)
if b>=10**6:
    if n>=b-1:
        ans=max(ans,a*(b-1)//b)
else:
    for i in range(1,min(b,n)+1):
        ans=max(ans,a*i//b-a*(i//b))
print(ans)

Submission status: Accepted

Solution code:
import math
a, b, n = map(int, input().split())

if n < b:
    ans = math.floor(a * n / b)
else:
    ans = math.floor(a * (b - 1) / b)

print(ans)

Submission status: Accepted

Solution code:
from sys import stdin
input = stdin.readline

A, B, N = map(int, input().split())

if B > N:
    tmp = N / B
else:
    tmp = (B - 1) / B

ans = tmp * A
print(int(ans))

Submission status: Accepted

Solution code:
a,b,n=map(int,input().split())
if n<=b-1:
  print(a*n//b)
else:
  print(a*(b-1)//b)

Submission status: Accepted

Solution code:
a, b, n = map(int, input().split())
if n >= b - 1:
    print(a - (a + b - 1) // b)
else:
    print((a * n) // b)

Submission status: Accepted

Solution code:
FAST_IO = 0
if FAST_IO:
    import io, sys, atexit
    rr = iter(sys.stdin.read().splitlines()).next
    sys.stdout = _OUTPUT_BUFFER = io.BytesIO()
    @atexit.register
    def write():
        sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
else:
    rr = raw_input
rri = lambda: int(rr())
rrm = lambda: map(int, rr().split())

####

def f(x, A, B):
    return (A * x // B) - A * (x // B)

def solve(A, B, N):
    # 0 <= x <= N  integer
    # max value Ax//B - A (x//B)
    q,r = divmod(N, B)
    ans = 0
    if q:
        ans = max(ans, f(q*B-1, A,B))
    ans = max(ans, f(N, A, B))
    return ans

def brute(A, B, N):
    ans = -1e9
    for x in range(0, N+1):
        ans = max(ans, f(x, A, B))
    return ans


    
print solve(*rrm())

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(300000)


def solve(A: int, B: int, N: int):
    if N < B:
        ret = A * N // B - A * (N // B)
    else:
        a = A * (B - 1) // B
        m = (N // B) * B - 1
        b = A * m // B - A * (m // B)
        c = A * N // B - A * (N // B)
        ret = max(a, b, c)
    print(ret)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    solve(A, B, N)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
A, B, N = map(int, input().split())
if N >= B - 1:
    N = B - 1
print((A * N) // B - (N // B) * A)

Submission status: Accepted

Solution code:
A, B, N = map(int, input().split())
if N >= B-1:
    print( (A*(B-1) // B) - A * ((B-1) // B))
else:
    print( (A*N) // B  - A * (N // B))

Submission status: Accepted

Solution code:
def main():
    a,b,n = tuple([int(t)for t in input().split()])
    
    if b-1<=n:
        ans = (a*(b-1))//b
        print(ans)
    else:
        ans = (a*n)//b
        print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def main():
    a, b, n = map(int, input().split())

    x = (n - (b - 2) + (b - 1)) // b
    y = max(0, b * x - 1)
    ans = max((a * y) // b - a * (y // b), (a * n) // b - a * (n // b))

    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
I = lambda : list(map(int,input().split()))
a,b,n=I()
n=min(n,b-1)
print((a*n)//b-a*(n//b))

Submission status: Accepted

Solution code:
a,b,n = map(int,input().split())
x = min(b-1,n)
print((a*x)//b-a*(x//b))

Submission status: Accepted

Solution code:
a,b,n=map(int,input().split())
x=min(b-1,n)
ans=a*x//b
print(ans)

Submission status: Accepted

Solution code:
line = [int(x) for x in input().split()]

a = line[0]
b = line[1]
c = line[2]

x = min([c, b-1])

import math

print(math.floor((a*x)/b) - (a*math.floor((x/b))))

Submission status: Accepted

Solution code:
A,B,N=map(int,input().split())
a=A*N//B-A*(N//B)
t=max(N//B*B-1,1)
b=A*t//B-A*(t//B)
print(max(a,b))

Submission status: Accepted

Solution code:
import math

a,b,n  = map(int, input().split())

print(math.floor(a/b * min(n,b-1)))

Submission status: Accepted

Solution code:
a,b,n=map(int,input().split())
x=min(n,b-1)
print(a*x//b - a*(x//b))

Submission status: Accepted

Solution code:
A, B, N = map(int, input().split())


if N >= B - 1:
    x = B - 1
else:
    x = N
ans = (A * x) // B - A * (x // B)
print (ans)

Submission status: Accepted

Solution code:
a, b, n = map(int, input().split())
x = min(b-1, n)
sub = a*x//b - a*(x//b)
print(sub)

Submission status: Accepted

Solution code:
def main():
    a,b,n = map(int,input().split())
    x=min(b-1,n)
    print((a*x)//b - a*(x//b))
    
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7 # 998244353
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    a, b, n = map(int,input().split())
    def f(x):
        return (a * x) // b - a * (x // b)

    if n < b:
        print(max(f(x) for x in range(max(0, n - 3), n + 1)))
    else:
        print(max(f(x) for x in range(max(0, b - 3), b + 1)))
resolve()

Submission status: Accepted

Solution code:
a, b, n = map(int, input().split())
x = min(n, b-1)
res = (a*x)//b-a*(x//b)
print(res)

Submission status: Accepted

Solution code:
import math
A, B, N = map(int, input().split())

x = min(N, B - 1)

ans = math.floor((A * x) / B)

print(ans)

Submission status: Accepted

Solution code:
a, b, n = map(int, input().split())
x = min(b-1, n)
ans = (a*x)//b - a*(x//b)
print(ans)

Submission status: Accepted

Solution code:
a,b,n=map(int,input().split())
ans=0
if a<b:ans=(a*(min(b-1,n)))//b-a*(min(b-1,n)//b)
for i in range(1,min(a+10,n+1)):ans=max(ans,(a*i)//b-a*(i//b))
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

a,b,n = map(int,input().split())
if b-1 <= n:
  x = b-1
else:
  x = n
print((a*x//b)-(a*(x//b)))

Submission status: Accepted

Solution code:
#create date: 2020-05-02 21:18

import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    a, b, n = na()
    x = min(n, b - 1)
    ans = a * x // b - a * ( x // b)
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
A, B, N = map(int, input().split())
x = B - 1 if B - 1 <= N else N
print(A*x//B - A*(x//B))

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
import sys
readline = sys.stdin.readline
read = sys.stdin.read


a,b,n = [int(i) for i in readline().split()]

print(a*(min(n,b-1))//b)

Submission status: Accepted

Solution code:
A,B,N = map(int,input().split())

print(int((A*min(N,B-1))/B))

Submission status: Accepted

Solution code:
input = raw_input

a, b, n = map(int, input().split(" "))

out = 0
x = min(b -1, n)
out = (a * x) // b  
#for x in range(b):
#    a * x 
print(out)

Submission status: Accepted

Solution code:
A, B, N = list(map(int,input().split()))
x = min(B-1,N)
print(int((A*x/B)//1-A*((x/B)//1)))

Submission status: Accepted

Solution code:
from math import ceil, floor

A, B, N = map(int, input().split())

if N>=B-1:
    x = B-1
    ans = floor((A*x)/B) - A*floor(x/B)
else:
    x = N
    ans = floor((A*x)/B) - A*floor(x/B)

print(ans)

Submission status: Accepted

Solution code:
a, b, n = list(map(int, input().split()))
x = min(n, b - 1)
ans = (a * x) // b
print(ans)

Submission status: Accepted

Solution code:
a,b,n=map(int,input().split())

saidai=min(b-1,n)

print((a*saidai)//b)

Submission status: Accepted

Solution code:
a, b, n = map(int, input().split())
x = min(n, b - 1)
print(a * x // b - a * (x // b))

Submission status: Accepted

Solution code:
def examA():
    K = I()
    A, B = LI()
    for i in range(A,B+1):
        if i%K==0:
            print("OK")
            return
    print("NG")
    return

def examB():
    X = I()
    now = 100
    ans = 0
    while(now<X):
        ans += 1
        now += now//100
    print(ans)
    return

def examC():
    N, M, Q = LI()

    ans = 0
    print(ans)
    return

def examD():
    A, B, N = LI()
    if N>=B-1:
        ans = (A*(B-1))//B
    else:
        ans = (A*N)//B
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examD()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Submission status: Accepted

Solution code:
A,B,N = map(int,input().split())

if N >= B:
    ans = ((A*(B-1))//B)-A*((B-1)//B)
else:
    ans = ((A*N)//B)-A*(N//B)
    
print(ans)

Submission status: Accepted

Solution code:
A,B,N=map(int,input().split())

def calc(x,A,B):
    return A*x//B-A*(x//B)
#for i in range(100):
#    print(i,calc(i,A,B))

if N>=B-1:
    print(calc(B-1,A,B))
else:
    print(calc(N,A,B))

Submission status: Accepted

Solution code:
a,b,n = map(int, input().split())

if n>=b-1:
    x = b-1
else:
    x = n

print(int(a*(x/b)))

Submission status: Accepted

Solution code:
A,B,N = map(int,input().split())

print(int(A*(min(N,B-1)/B-int(min(N,B-1)/B))))

Submission status: Accepted

Solution code:
a, b, n = map(int, input().split())
x = min(n, b - 1)
print(int(a * x / b) - a * int(x / b))

Submission status: Accepted

Solution code:
import math
a,b,n=map(int,input().split())
x=min(n,b-1)
print(math.floor(a*x/b)-a*math.floor(x/b))

Submission status: Accepted

Solution code:
a, b, n =  list(map(int, input().split()))
i = min(b - 1, n)
print(int(a * i / b) - a * int(i / b))

Submission status: Accepted

Solution code:
a, b, n = map(int, input().split())

x = min(b - 1, n)
print(int(a * x / b) - a * int(x / b))

Submission status: Accepted

Solution code:
a,b,n=map(int,input().split())
if b-1<=n:
  x=b-1
else:
  x=n
print((a*x)//b-a*(x//b))

Submission status: Accepted

Solution code:
A,B,N = map(int,input().split())
if B >= N + 1:
    print(A * N // B)
else:
    print(A * (B-1) // B)

Submission status: Accepted

Solution code:
a,b,n=map(int,input().split())
x=min(n,b-1)
l=(a*x)//b
r=a*(x//b)
print(l-r)

Submission status: Accepted

Solution code:
a,b,n = map(int,input().split())

def f(i):
    return (a * i) // b - a * (i // b)

if n < b:
    print(f(n))
else:
    print(f(b - 1))

Submission status: Accepted

Solution code:
A, B, N = map(int, input().split())
n = min(B-1, N)
print(A*n//B)