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

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

    return calc(min(n, b-1))

print(m())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
A,B,N=list(map(int, (stdin.readline().strip().split())))

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

Submission status: Accepted

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

# for x in range(1, n+1):
#     print(x, end=' ')
#     tmp = (a*x)//b - a*(x//b)
#     print(tmp, end=' ')
#     print((a*x)//b, end=' ')
#     print(a*(x//b))

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

Submission status: Accepted

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

Submission status: Accepted

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

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

main()

Submission status: Accepted

Solution code:
ans =0
A,B,N = list(map(int,input().split()))
# for x in range(B):
#     ans = max(ans ,int(A* x/ B)-A* int(x/B))

# ans = int()
# search_range = min()
if N >= B:
    x = B-1
else:
    x = N

print(int(A*x/B))

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A, B, N = MAP()

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

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

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A, B, N = MAP()

x = min(N, B-1)

print((A*x)//B)

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A, B, N = MAP()

x = min(N, B-1)

print(int(A*x/B))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#atcoder template
def main():
    import sys
    imput = sys.stdin.readline
    #ここにコード
    #input
    A, B, N = map(int, input().split())

    #output
    #x = B*k + C (0 <= C < B)
    #A*x/B = A*k + C/B
    #x/B = k + C/B

    #floor(A*x/B) = floor(A*k + A*C/B)
    #floor(x/B) = k
    #eq = A*k + floor(A*C/B) - A*k = floor(A*C/B)
    import math
    D = min(N, B-1)
    print(math.floor(A*D/B))

if __name__ == "__main__":
    main()

Submission status: Accepted

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

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:

# 初期入力
import sys
#input = sys.stdin.readline
A,B,N = (int(x) for x in input().split())
ans =0
if B <=N:
    ans =int(A*(B-1)/B) 
else:
    ans =int(A*N/B)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#copy
import math
a, b, n = list(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())

ans = 0

if n < b:
    ans = int(a*n/b)
    print(ans)

else:
    ans = int(a * (b - 1) / b)
    print(ans)

Submission status: Accepted

Solution code:
import math
a, b, n = list(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:
#!/usr/bin/env python3
# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
import sys


def solve(A: int, B: int, N: int):
    def f(x: int) -> int:
        return int(A*x/B) - A*int(x/B)
    print(f(min(B-1, N)))


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
a,b,n = map(int,input().split())
if b <= 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,c=map(int,input().split())
if c+1>=b:
    ans=int(a*(b-1)/b)
else:
    ans=int(a*c/b)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math

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

if b <= 10**6:
    maxVal = 0

    for i in range(b):
        if i > n:
            break
        val = math.floor(a*i/b)-a*math.floor(i/b)
        if val > maxVal:
            maxVal = val

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

Submission status: Accepted

Solution code:
A, B, N = [eval(v) for v in input().strip().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:
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())
c_0 = 0
m = min(n, b-1)
x = int(a * m / b)
print(x)

Submission status: Accepted

Solution code:
import math


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


A, B, n = map(int, input().split())
print(eq_value(A, B, min(B-1, n)))

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()
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:
def solve(a, b, n):
    def f(x):
        return a*x//b - a*(x//b)
    y = min(b-1,n)
    return max(f(y-i) for i in range(min([a,b,n])))
assert solve(5, 7, 4) == 2
assert solve(11, 10, 9) == 9

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(1000000)
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 = [int(x) for x in input().split()]
# a = 10 ** 6
# b = 10 ** 12
# n = 10 ** 12

m = 0
if (n < b):
    # math.floor(x / b) = 0
    m = math.floor(a * n / b) # - a * math.floor(n / b)
else:
    m = math.floor(a * (b - 1) / b) - a * math.floor((b - 1) / b)
    #for i in range(n // b - 1, n + 1, b):
    # for i in range(n):
    #     print(i, math.floor(a * i / b),  a * math.floor(i / b), math.floor(a * i / b) - a * math.floor(i / b))
    #     m = max(m, math.floor(a * i / b) - a * math.floor(i / b))

print(m)

Submission status: Accepted

Solution code:
# floor(Ax/B) - A floor(x/B) の最大値Mを求める
# xはN以下の非負整数
# floor(Ax / B) = M + A floor(x / B)
# x / B = k + r
# Ax / B = Ak + Ar

# floor(Ak + Ar) = M + A floor(k + r)
# Ak + floor(Ar) = M + Ak + A floor(r)
# floor(Ar) = M

# r = x / B - k
# M = floor(A * (x / B - k))
#   = floor(A * x /B) - Ak
#   = floor(A/B * x) - Ak
#   = floor(A/B * x) - A * (x // B) 

# A B N
# 5 7 4

# M = floor(5/7 * x) - 5 * (x // 7)


# A B N 
# 11 10 9
# M = floor(11 / 10 * x) - 11 * (x // 10)

import math

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

def resolve_v1(A, B, N):
    maxM = 0
    for x in range(N+1): # O(N)
        M = calcM(A, B, x)
        maxM = max(maxM, M)

    return maxM

def resolve_v2(A, B, N):
    # x == kB - 1
    maxM = calcM(A, B, N)

    for x in filter(lambda x: (x + 1) % B == 0, range(N+1)): # O(N/B)
        maxM = max(maxM, calcM(A, B, x))
    return maxM


def resolve_v3(A, B, N):
    return calcM(A, B, min(N, B - 1))

if __name__ == '__main__':
    A, B, N = map(int, input().split())
    M = resolve_v3(A, B, N)
    print(M)

Submission status: Accepted

Solution code:
# floor(Ax/B) - A floor(x/B) の最大値Mを求める
# xはN以下の非負整数
# floor(Ax / B) = M + A floor(x / B)
# x / B = k + r
# Ax / B = Ak + Ar

# floor(Ak + Ar) = M + A floor(k + r)
# Ak + floor(Ar) = M + Ak + A floor(r)
# floor(Ar) = M

# r = x / B - k
# M = floor(A * (x / B - k))
#   = floor(A * x /B) - Ak
#   = floor(A/B * x) - Ak
#   = floor(A/B * x) - A * (x // B) 

# A B N
# 5 7 4

# M = floor(5/7 * x) - 5 * (x // 7)


# A B N 
# 11 10 9
# M = floor(11 / 10 * x) - 11 * (x // 10)

import math

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

def resolve_v1(A, B, N):
    maxM = 0
    for x in range(N+1): # O(N)
        M = calcM(A, B, x)
        maxM = max(maxM, M)

    return maxM

def resolve_v2(A, B, N):
    # x == kB - 1
    maxM = calcM(A, B, N)

    for x in filter(lambda x: (x + 1) % B == 0, range(N+1)): # O(N/B)
        maxM = max(maxM, calcM(A, B, x))
    return maxM


def resolve_v3(A, B, N):
    maxM = calcM(A, B, N)

    k, r = divmod(N, B)
    if k and B * k -1 <= N:
        # k * B - 1で調査
        maxM = max(maxM, calcM(A, B, B - 1))
    # if r == 0:
    #     maxM = max(maxM, calcM(A, B, N - 1))

    maxM = calcM(A, B, min(N, B - 1))


    return maxM

if __name__ == '__main__':
    A, B, N = map(int, input().split())
    M = resolve_v3(A, B, N)
    print(M)

Submission status: Accepted

Solution code:
# floor(Ax/B) - A floor(x/B) の最大値Mを求める
# xはN以下の非負整数
# floor(Ax / B) = M + A floor(x / B)
# x / B = k + r
# Ax / B = Ak + Ar

# floor(Ak + Ar) = M + A floor(k + r)
# Ak + floor(Ar) = M + Ak + A floor(r)
# floor(Ar) = M

# r = x / B - k
# M = floor(A * (x / B - k))
#   = floor(A * x /B) - Ak
#   = floor(A/B * x) - Ak
#   = floor(A/B * x) - A * (x // B) 

# A B N
# 5 7 4

# M = floor(5/7 * x) - 5 * (x // 7)


# A B N 
# 11 10 9
# M = floor(11 / 10 * x) - 11 * (x // 10)

import math

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

def resolve_v1(A, B, N):
    maxM = 0
    for x in range(N+1): # O(N)
        M = calcM(A, B, x)
        maxM = max(maxM, M)

    return maxM

def resolve_v2(A, B, N):
    # x == kB - 1
    maxM = calcM(A, B, N)

    for x in filter(lambda x: (x + 1) % B == 0, range(N+1)): # O(N/B)
        maxM = max(maxM, calcM(A, B, x))
    return maxM


def resolve_v3(A, B, N):
    maxM = calcM(A, B, N)

    k, r = divmod(N, B)
    if k and B * k -1 <= N:
        # k * B - 1で調査
        maxM = max(maxM, calcM(A, B, k * B - 1))
    # if r == 0:
    #     maxM = max(maxM, calcM(A, B, N - 1))

    maxM = calcM(A, B, min(N, B - 1))


    return maxM

if __name__ == '__main__':
    A, B, N = map(int, input().split())
    M = resolve_v3(A, B, N)
    print(M)

Submission status: Accepted

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

Submission status: Accepted

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

if B <= N:
    print(func(A, B, B - 1))
else:
    print(func(A, B, N))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#D
a,b,n = map(int,input().split())
k = min(n,b-1)

print(int(a*k / b) - a * int(k/b))

Submission status: Accepted

Solution code:
import math

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

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


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

print(ans)

Submission status: Accepted

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


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


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

Submission status: Accepted

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

print(A)

Submission status: Accepted

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

max_score = 0
y = min(b, n)

for x in range(max(y - 100000, 1) , min(y + 200000, n+1)):
    score = a * x // b - a * ( x // b )
    if score > max_score:
        max_score = score
print(max_score)

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:
#!/usr/bin/env Pypy3
import math
a, b, n = map(int, input().split())


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


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

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

Submission status: Accepted

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

Q = N % B
answer = 0

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

else:
    answer = A * N // B
    print(answer)

Submission status: Accepted

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

def floor(x):
    out = (A * x)//B - A * (x//B)
    return out

max = 0
#for i in range(N//2, N + 1):
    #if(floor(i) > max):
        #max = floor(i)

if(N < (B-1)):
    max = floor(N)
else:
    max = floor(B-1)

print(max)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import sys

a, b, n = map(int, sys.stdin.readline().rstrip().split())
tmp = min(b - 1, n)

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

Submission status: Accepted

Solution code:
from math import floor
def Main(A, B, N):
    if N < B:
        return floor(A*N/B)-A*floor(N/B)
    else:
        return floor(A*(B-1)/B)-A*floor((B-1)/B)

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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:
#ABC165d
import math

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

print(math.floor(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))

Submission status: Accepted

Solution code:
from sys import stdout, stdin
from queue import Queue
from collections import defaultdict
import math
a,b,n = map(int, stdin.readline().strip().split())
x = min(b - 1, n)
ans = math.floor(a * x / b) - a * math.floor(x / b)
stdout.writelines(str(ans) + '\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:
# -*- coding: utf-8 -*-
"""
Created on Tue May  5 22:13:53 2020

@author: shinba
"""


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

m = min(B-1,N)

print(int(A*m/B))

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import math

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin, stdout
from collections import defaultdict
import math
from queue import Queue

a, b, n = map(int, stdin.readline().strip().split())

x = min(b - 1, n)

ans = math.floor(a * x / b) - a * math.floor(x / b)

stdout.writelines(str(ans) + '\n')

Submission status: Accepted

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import math

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from sys import stdin
import math
import fractions
from collections import deque
from collections import Counter
import itertools

INF = 10 ** 10

# 1 <= A <= 10**6
# 1 <= B <= 10**12
# 1 <= N <= 10**12
A, B, N = [int(x) for x in stdin.readline().rstrip().split()]

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

ans = math.floor(A*ans_x/B) - A*math.floor(ans_x/B)

print(ans)

Submission status: Accepted

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

if B==1:
  print(0)
else:
  tb = B - 1
  tp_pre = 0
  while(True):
    tp = (A*tb)//B - A*(tb//B)
    if tp > tp_pre:
      tp_pre = tp
    tb += B
    if tb > N:
      break
  if (B > N):
    print((A*N)//B - A*(N//B))
  else:
    print(int(tp_pre))

Submission status: Accepted

Solution code:
from math import floor

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

x = B - 1 if B <= N else N
print(floor(A * (x / B % 1)))

Submission status: Accepted

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

from math import floor
def f(x): return floor(A*x/B)

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

Submission status: Accepted

Solution code:
import math

input1 = input().split()
A = int(input1[0])
B = int(input1[1])
N = int(input1[2])

x = 0
result = 0
if N >= B-1:
    x = B-1
    result = (A*(x%B) - (A*x)%B)/B
elif N < B-1:
    x = N
    result = (A*(x%B) - (A*x)%B)/B

print(int(result))

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))
else:
    print(f(b - 1))

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
def equation(a,b,n):
  return math.floor((a*n)/b)-a*math.floor(n/b)
d,e,f = map(int,input().split())
K = min(e-1,f)
print(equation(d,e,K))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b, n = map(int, input().split())
print(a * min((b-1), n) // 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:
func = []
A , B , N = map(int , input().split())
"""
for x in range(N+1):
    func.append((A*x) // B  - A * (x // B ))
print(max(func))
"""
if B - 1 > 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())

if n < b-1:
    print(a*(n%b)//b)
else:
    print(a*((b-1)%b)//b)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    a,b,n = LI()
    r = 0
    if b < 10**6:
        for k in range(1,min(b,n+1)):
            u = a*k//b - a*(k//b)
            if r < u:
                r = u
        return r

    i = 1
    while True:
        t = b*i
        if t % a == 0:
            k = t // a
        else:
            k = t // a + 1
        if k > n:
            break
        u = a*k//b - a*(k//b)
        if r < u:
            r = u
        i += 1

    return r


print(main())

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
a, b, n = map(int, input().split())
if n < b - 1:
    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())
def f(x):
    return int(A*x/B)-A*int(x/B)
print(f(min(B-1,N)))

Submission status: Accepted

Solution code:
import math
 
a,b,n = map(int,input().split())
cnt = 0
t = 0
if n<=b-1:
    print(math.floor(a*n/b))
#    exit()
else:
    print(math.floor(a*(b-1)/b))

Submission status: Accepted

Solution code:
#  =========     /\       /|    |====/|
#      |        /  \       |    |   / |
#      |       /____\      |    |  /  |
#      |      /      \     |    | /   |
#  ========= /        \  =====  |/====|  
#  code

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import numpy as np
import math
import scipy
import itertools

def solve():
    a, b, n = map(int, input().split())
    x = min(b-1, n)
    print(math.floor(a*x/b)-a*math.floor(x/b))
    return 0

if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    a,b,n=map(int, readline().rstrip().split())

    x=min(n,b-1)
    ans=(a*x)//b-a*(x//b)
    print(ans)
    #arr=list(map(int, readline().rstrip().split()))
    #n=int(readline())
    #ss=readline().rstrip()
    #yn(1)

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline

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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations

A, B, N = [int(_) for _ in input().split()]

x = min(B-1, N) # 0 <= x < B and 0 <= x <= N
a = (A * x) // B - A * (x // B)

print(int(a))

Submission status: Accepted

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

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

Submission status: Accepted

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

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:
def f(x) :
    return ((A * x) // B) - 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())
 
print(int(a*min(b-1, n)/b) - a*int(min(b-1, n)/b))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, math
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

A, B, N = rl()

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

if N < B-1:
	print(f(N))
else:
	print(f(B-1))

Submission status: Accepted

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

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

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)/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:
A, B, N = list(map(int, input().split()))

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

Submission status: Accepted

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

x = b - 1 if b <= n else n
ret = int(a * x / b) - (a * int(x / b))
print(ret)