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:
i = list(map(int, input().split()))
A = i[0]
B = i[1]
N = i[2]
if N < B-1:
    print(A * N // B)
else:
    print(A * (B-1) // B)

Submission status: Accepted

Solution code:
import math

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

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

Submission status: Accepted

Solution code:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
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 fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    A,B,N=MI()
    y = (N+1)//B
    x = y*B-1
    x = min(x,N)    

    def f(x):
        return (A*x)//B - A*(x//B)
    if(x<0):
        print(f(N))
    else:
        print(f(x))
    # print(max(f(x),f(N),f(N-1)))
if __name__ == '__main__':
    main()

Submission status: Accepted

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

    x = min(B - 1, N)

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


if __name__ == '__main__':
    main()

# editorial
# f(x)=(A * x // B) - A * (x // B)
# f(x+B)==f(x)
# 周期性があるので
# 0<=x<Bの場合を考えればよい
# (A * x // B)は広義単調増加
# A * (x // B) == 0
# 定義域で最大のx=min(B-1,N)のとき最大になる

Submission status: Accepted

Solution code:
s = input().split()

A = int(s[0])
B = int(s[1])
N = int(s[2])

result = 0

n = (N // B) * B - 1
if (n < 0):
  n = 0

a = (A*N)//B - A*(N//B)
b = (A*n)//B - A*(n//B)
"""
for x in range(N+1):
  y = (A*x)//B - A*(x//B)
  if y > result:
    result = y
"""
    
if (a > b):
  result = a
else:
  result = b
print(result)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from math import floor

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


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

x = min(B-1, N)

ans = floor((A * x) / B) - A * floor(x/B)

print(ans)

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

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

n = min(B-1,N)

ans = (A*n)//B
print(ans)

Submission status: Accepted

Solution code:
import math

def floor(num,a,b):
    return math.floor(a*num/b)-(a*math.floor(num/b))

a,b,n = map(int,input().split())
print(floor(min(b-1,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((a* x) // b)

Submission status: Accepted

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

Submission status: Accepted

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

if b <= n:
  if n != 1:
    n = b - 1

ans1 = math.floor((a * n) / b)
ans2 = a * math.floor(n / b)
ans3 = ans1 - ans2

print(ans3)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from math import floor

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

Submission status: Accepted

Solution code:
a,b,n=map(int,input().split())
if n<=b-1:
    x=n
else:
    x=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
if(N<B-1):
    x=N
ans=int(A*x/B)-A*int(x/B)
print(ans)

Submission status: Accepted

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

x = N

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

print(ans)

Submission status: Accepted

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

x = min(B-1, N)

ans = int(A*x/B) - A*int(x/B)

print(ans)

Submission status: Accepted

Solution code:
a,b,n = list(map(int, list(input().split(' '))))
x = n
if (n>=b-1):
    x = b-1
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)
print(int(a*x/b))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
A, B, N = map(int, input().split())

num = min(B-1, N)

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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


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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

if n < b :
    print(func(n));
else :
    print(func(b-1));

Submission status: Accepted

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

if a==1:
  print(0)
else:
  c = min(b-1, n)
  print((a*c)//b)

Submission status: Accepted

Solution code:
(a, b, c)=[int(x) for x in input().split()]
print((a*(b-1)//b)-a*((b-1)//b) if b-1 < c else (a*c//b)-a*(c//b))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
(a, b, c)=[int(x) for x in input().split()]
if b-1 < c:
  print((a*(b-1)//b)-a*((b-1)//b))
elif b-1 >= c:
  print((a*c//b)-a*(c//b))

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
##########
import math
ii = lambda:int(input())
li = lambda:list(map(int,input().split()))
##########
def main(a,b,n):
    x = min(b-1,n)
    return calc(a,b,x)

def calc(a,b,x):
    return math.floor(a*x/b) - a*math.floor(x/b)

a,b,n = li()
print(main(a,b,n))

Submission status: Accepted

Solution code:
def d_floor_function():
    A, B, N = [int(i) for i in input().split()]
    return (lambda x: ((A * x) // B) - A * (x // B))(min(B - 1, N))

print(d_floor_function())

Submission status: Accepted

Solution code:
def cal(A,B,x):
    return int((A*x)/B) - A*int(x/B)

def main():
    A,B,N = map(int,input().split())
    if N <= B-1:
        ans = cal(A,B,N)
    else:
        ans = cal(A,B,B-1)
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import math
abn = list(map(int,input().split()))

x = min(abn[1] - 1, abn[2])
m = math.floor(abn[0] * x / abn[1]) - abn[0] * math.floor(x / abn[1])
print(m)

Submission status: Accepted

Solution code:
from math import floor

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

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

Submission status: Accepted

Solution code:
import math
A,B,N = map(int,input().split())
C = N - N%B
ans = A*(C-1) // B - A*math.floor((C-1)/B)
if B > N:
    ans = math.floor(A*N/B) - A*math.floor(N/B)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,n=map(int,input().split())
def f(x):
    return a*x//b-a*int(x/b)
if n<b:
    ans =f(n)
else:
    t = n
    u = b - 1
    ans=max(f(t),f(u))
print(ans)

Submission status: Accepted

Solution code:
a,b,n=map(int,input().split())
def f(x):
    return int(a*x//b)-a*int(x//b)
if n<b:
    print(f(n))
elif n==b:
    print(f(n-1))
elif n>b:
    t = n
    u = n - (n%b+1)
    print(max(f(t),f(u)))

Submission status: Accepted

Solution code:
import math
A,B,N = map(int,input().split())
C = N - N%B
ans = A*(C-1) // B - A*math.floor((C-1)/B)
if B > N:
    ans = A*N // B - A*math.floor(N/B)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

mx = a*n//b
if n//b < 1:
    print(mx)
else:
    x = (a*b-a)//b
    print(x)

Submission status: Accepted

Solution code:
a,b,n=map(int,input().split())
def f(x):
    return a*x//b-a*int(x//b)
if n<b:
    ans =f(n)
else:
    t = n
    u = b - 1
    ans=max(f(t),f(u))
print(ans)

Submission status: Accepted

Solution code:
A, B, N = map(int, input().split())
 
def f(x):
    return (A*x)//B-A*(x//B)
 
X = N
Y = min(B-1,N)
 
print(max(f(X),f(Y)))

Submission status: Accepted

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

import math

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

    if b > n:
        print(math.floor(a*n/b))

    else:
        print(math.floor(a*(b-1)/b) - a*math.floor((b-1)/b))

if __name__ == '__main__':
    main()

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:
    ans =f(n)
else:
    t = n
    u = b - 1
    ans=max(f(t),f(u))
print(ans)

Submission status: Accepted

Solution code:
a,b,n=map(int,input().split())
#0<=x<=b-1でfloor(x/b)は0となるので単調増加になる
#単調増加なのでb-1とnの小さいほうがxの最大値
x=min(b-1,n)

print(a*x//b)

Submission status: Accepted

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

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

print(left - right)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
def f(x):
    return math.floor(a*x/b) - a*math.floor(x/b)

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

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

Submission status: Accepted

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

x = b - 1
x = min(x,n)
print(x*a//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())

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

X = N
Y = min(B-1,N)

print(max(f(X),f(Y)))

Submission status: Accepted

Solution code:
import sys

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

if (N>=2*B-1):
    n=B-1
elif (B<=N<2*B-1):
    n=max(N-B,B-1)
else:
    n=N

print(int(A*n/B))

Submission status: Accepted

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

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


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

Submission status: Accepted

Solution code:
INT_MAX=10**19+7
MOD=10**12+7
def INPUT():return list(int(i) for i in input().split())
def LIST_1D_ARRAY(n):return [0 for _ in range(n)]
def LIST_2D_ARRAY(m,n):return [[0 for _ in range(n)]for _ in range(m)]
#=======================================================================
import math as M
a,b,n=INPUT()
i=min(b-1,n)
ans=int(a*i/b)-a*int(i/b)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

x = b - 1

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

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

Submission status: Accepted

Solution code:
import math

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

def f(a,b,x):
    return math.floor(a*x/b)-a*math.floor(x/b)

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

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:
a,b,n=map(int,input().split())

nb=n//b

#xmax=0
if n<b:
    xmax=a*n//b
else:
    xmax=0
#    for xb in range(nb):
#        xv=(a*xb*b+a*(b-1))//b-a*xb
#        xmax=max(xmax,xv)
    xb=nb-1
    xv=(a*xb*b+a*(b-1))//b-a*xb
    xmax=max(xmax,xv)
    xb=nb
    xv=(a*xb*b+a*n%b)//b-a*xb
    xmax=max(xmax,xv)

print(xmax)

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())

f = lambda x: (A * x) // B - A * (x // B)
print(f(min((B - 1), n)))

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 - A*(N//B))

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(n))
elif n==b:
    print(f(n-1))
elif n>b:
    t = n
    u = b - 1
    print(max(f(t),f(u)))

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(n,b-1)
print((a*x)//b-a*(x//b))

Submission status: Accepted

Solution code:

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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


print(ans)

Submission status: Accepted

Solution code:
a,b,n=map(int,input().split())
def f(x):
    return int(a*x/b)-a*int(x/b)
if n<b:
    print(f(n))
elif n==b:
    print(f(n-1))
elif n>b:
    #t = n
    #u = b - 1
    #print(max(f(t),f(u)))
    print(f(b-1))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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:
    ans =f(n)
else:
    t = n
    u = b - 1
    ans=max(f(t),f(u))
print(ans)

Submission status: Accepted

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

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 b <= n:
  print((a*(b-1)) // b)
else:
  print((a*n)//b)

Submission status: Accepted

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

nb=n//b

#xmax=0
if n<b:
    xmax=a*n//b
else:
    xmax=0
#    for xb in range(nb):
#        xv=(a*xb*b+a*(b-1))//b-a*xb
#        xmax=max(xmax,xv)
    xb=nb-1
    xv=(a*xb*b+a*(b-1))//b-a*xb
    xmax=max(xmax,xv)
    xb=nb
    xv=(a*xb*b+a*n%b)//b-a*xb
    xmax=max(xmax,xv)

print(xmax)

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

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

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

print(f(min(N,B-1)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
import math

[A, B, N] = [float(x) for x in input().rstrip().split()]


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

print(int(math.floor(A*x/B)-A*math.floor(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:
import numpy as np

ABN=np.array(input().split(" "),dtype=np.int64)
A=ABN[0]
B=ABN[1]
N=ABN[2]

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

print(calc)

Submission status: Accepted

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

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

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,ceil
import fractions
import collections
import itertools
from collections import deque
A,B,N=map(int,input().split())

piv=B/A  #基本数

#for i in range(0,30):
#    print(A,i,B,floor(A*i/B)-A*floor(i/B))

#A<=Bなら
#0,0,.. 1,1,.. ... (A-1),(A-1),...が
#先頭から(B%A)の数字まではceil(piv)こ、あとはfloor(piv)こ
#→これより、この答えはmod(B)の空間で単調増加とわかる
#よって、f(min(B-1,N))が答え

#A>Bでも同じくmod(B)にて単調増加なのを調べてたはずなので

#いずれにせよf(min(B-1,N))が答え
cnt=0
#print(ceil(piv)*(B%A))
"""
if A<=B:
    if N>=B-1:
        print(A-1)
    else:
        if ceil(piv)*(B%A)>N:
            print(floor(N/ceil(piv)))
        else:
            N=N-ceil(piv)*(B%A)
            #print(N,N//floor(piv))
            cnt=(B%A)
            print(cnt+N//floor(piv))
else:  #A>B
    l=[0]
    for i in range(1,B):
        l.append(max(l[i-1],floor(A*i/B)-A*floor(i/B)))
    #print(l)
    if N>=len(l):
        print(l[len(l)-1])
    else:
        print(l[N])
"""
def f(A,B,N):
    return floor(A*N/B)-A*floor(N/B)
print(f(A,B,min(B-1,N)))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
l=list(map(int,input().split()))
a=l[0]
b=l[1]
n=l[2]
if b-1<=n:
  i=b-1
else:
  i=n
y=(((a*i)/b)//1)-(a*((i/b)//1))
print(int(y))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B, N = map(int, input().split())
from math import floor
from math import gcd
from math import ceil
k = gcd(A, B)

As = A // k
Bs = B // k

Q = min(N, B-1)
R = ceil(Bs / As)
res = []
for b in range(Q, Q - R, -1):
    res.append(round(floor(b*As/Bs) - A*floor(b/B)))

print(max(res))

Submission status: Accepted

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

Submission status: Accepted

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

print(max(A*a//B-A*(a//B),A*b//B-A*(b//B)))

Submission status: Accepted

Solution code:
A, B, N = map(int,input().split())
import math
x1 = N
x2 = min(N,B-1)
def f(x): 
    return A*x//B - A*(x//B)
print(max(f(x1),f(x2)))

Submission status: Accepted

Solution code:
import math

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

A, B, N = map(int, input().split())
print(calc(min(B-1, N)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# モジュールのインポート
import math

# 標準入力の取得
A, B, N = list(map(int, input().split()))


def f(x: int) -> int:
    return math.floor(A*x/B) - A*math.floor(x/B)


# 求解処理
result = f(min(B-1, N))

# 結果出力
print(result)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
A, B, N = map(int, input().split())
t = N // B
if N % B == 0:
    a = max(0, N-1)
    b = N
    d = max(0,t*B-1)
    e = 1
    f = 0
else:
    a = max(0, t * B - 1)
    b = N
    d = max(0,N-1)
    e = 1
    f = 0

k = A * N // B
if A * N % B == 0:
    case = [a, b, max(min(B-1,N),0),d,e,f]
else:
    c = max(0,k*B//A+1)
    g = max(0,k*B//A)
    case = [a,b,max(min(B-1,N),0),d,e,f,g]

ans = 0
for i in case:
    ans = max(ans,A*i//B-A*(i//B))

print(ans)

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)) )

Submission status: Accepted

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

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

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:
import math
a,b,n = map(int,input().split())
x = min(b-1,n)
print(math.floor(a*x/b)-a*math.floor(x/b))

Submission status: Accepted

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

print(keep)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
def fs(A, B, x):
    return math.floor(A*x/B) - A * math.floor(x/B)


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

    print(fs(A, B, min(N, B-1)))
    return 0

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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

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

print(int(z))

Submission status: Accepted

Solution code:
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
def resolve():
    A, B, N = lr()
    print((A*min(N, B-1))//B)
resolve()

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline
MOD = 1000000007

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


    

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


x = min(B-1,N)

print(f(x))



#if A == B:
#    x = A - 1
#    print(x)
#
#else:
#    res = 0
#    left = 0
#    right = N
#
#    left_res = 0
#    right_res = 0
#
#    while (left+1) != right:
#        left_res = f(left)
#        right_res = f(right)
#        mid = (right+left)//2
#        if left_res > right_res:
#            right = mid
#        else:
#            left = mid
#
#    print(max(f(left),f(right)))

Submission status: Accepted

Solution code:
from math import floor

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

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

print(ans)

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:
import math
a,b,n=map(int,input().split())
c=min(b-1,n)
print(math.floor(a*c/b)-a*math.floor(c/b))

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

x = min(b-1,n)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math


def main():
    a,b,n = map(int,input().split())
    # m = math.floor(a * 0 /b) - a * math.floor(0/b)
    # for i in range(1,min(b-1,n)+1):
    #     if m < math.floor(a * i / b) - a * math.floor(i/b):
    #         m = math.floor(a * i / b) - a * math.floor(i/b)
    i = min(b-1,n)
    m = a*i//b - a*(i//b)
    
    print(m)
if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
 
A, B, N = map(int, input().split())
 
 
ans1 = 0
 
if N > B - 1:
    x = B-1
    print(int((A * x) / B) - A * int(x / B))
elif N <= B - 1:
    x = N
    print(int((A * x) / B) - A * int(x / B))

Submission status: Accepted

Solution code:
import math
def f(x):
    return math.floor(A*x/B)

A, B, N = map(int, input().split())
print(f(min(B-1,N)))

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import floor
A,B,N = input().split()
a = int(A)
b = int(B)
n = int(N)
if n<= (b-1):
  print(floor(a*n/b)-a*floor(n/b))
else:
  print(floor(a*(b-1)/b))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
import math

def solve(A: int, B: int, N: int):
    x = min(B-1, N)
    print(math.floor(A*x/B) - A*math.floor(x/B))
    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:
import math
import sys
input = sys.stdin.readline

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

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from math import floor

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

Submission status: Accepted

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

if B > N: x = N
else:
    x = 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())
ans = min(N, B - 1)
print(math.floor(ans * A /B))

Submission status: Accepted

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

Submission status: Accepted

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