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 math as m
A, B, N = map(int, input().split())
if N >= B: print(m.floor(A * -1 / B) - A * m.floor(-1 / B))
else: print(m.floor(A * N / B) - A * m.floor(N / B))

Submission status: Accepted

Solution code:
a,b,n = map(int,input().split())
#(a*x)//b - a*(x//b) の最大値を求める
if b > n:
    # ax//b だけ考えればいい
    print(a*n//b)
else:
    # ax//b か　bより大きいx で探す
    x = 2*b-1
    first = a*(b-1)//b
    second = (a*x)//b - a*(x//b)
    print(first if first >= second else second)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B, N = [int(s) for s in 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 = list(map(int, input().split()))
if b > n:
    print((a*n)//b - a *(n//b))
elif b <= n:
    print((a*(b-1))//b )

Submission status: Accepted

Solution code:
import numpy as np
a,b,n = map(int,input().split())
ans = 0
if b == 1:
    print(0)
    exit()
else:
    for k in range(1,int(n/b)+1+1):
        if k*b -1 <= n :
        # print(k,k*b-1,n)
            ans = max(ans, np.floor(a*(k*b-1)/b) - a * (k-1))
        else:
        # print(k,k*b-1,n)
            ans = max(ans, np.floor(a*n/b) - a*(k-1))
        # break
print(int(ans))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8

import sys
import math
import collections
import itertools
INF = 10 ** 13
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def lcm(x, y) : return (x * y) // math.gcd(x, y)
def I() : return int(input())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]
def LS() : return input().split()
def RS(N) : return [input() for _ in range(N)]
def LRS(N) : return [input().split() for _ in range(N)]
def PL(L) : print(*L, sep="\n")
def YesNo(B) : print("Yes" if B else "No")
def YESNO(B) : print("YES" if B else "NO")

def F(A, B, x):
    return math.floor(A*x / B) - A*math.floor(x / B)
# def F1(A, B, x):
#     return math.floor(A*x / B)
# def F2(A, B, x):
#     return A*math.floor(x / B)

A, B, N = LI()

# import matplotlib.pyplot as plt
# plt.plot(range(1, N+1), [F(A, B, y) for y in range(1, N+1)])
# plt.plot(range(1, N+1), [F1(A, B, y) for y in range(1, N+1)])
# plt.plot(range(1, N+1), [F2(A, B, y) for y in range(1, N+1)])
# plt.show()

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

Submission status: Accepted

Solution code:
import math
A,B,N=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:
from math import floor

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

if a == 1 or b == 1:
    print(0)
elif n < b:
    print(floor(a*n/b))
else:
    print(floor(a*(b-1)/b))

Submission status: Accepted

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

n = min(n, b-1)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,B,N=list(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())

if A%B==0:
    print(0)
elif N<B:
    print((A*N)//B)
else:
    print((A*(B-1)//B-A*((B-1)//B)))

Submission status: Accepted

Solution code:
a,b,N = [int(x) for x in input().split()]
print(a * min(b-1,N) // b)

Submission status: Accepted

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

if b <= n:
    x = b-1

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

Submission status: Accepted

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

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

Submission status: Accepted

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

else:
    print(math.floor(A*(N)/B)-A*math.floor((N)/B))
    exit()

Submission status: Accepted

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

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

f1 = 0
f2 = 0
if N >=B:
    f1 = int(A*(B-1)/B)
    f2 = A*int((B-1)/B)
else:
    f1 = int(A*N/B)
    f2 = A*int(N/B)

ans = f1-f2
print(ans)

Submission status: Accepted

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

def func(A, B, x):
    return math.floor(A*x/B) - A * math.floor(x/B)
    
if B > N:
    print(func(A, B, N))
elif B == N:
    print(func(A, B, N - 1))
else:
    print(func(A, B, B - 1))

Submission status: Accepted

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

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

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

    # 分母のBに注目すると、1 <= x <= B　を調べれば良い
    if B > N:
        print(f(N))
    else:
        print(f(B-1))



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

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

    # さぶたん
    left, right = 1, N
    cnt = 500
    ans = 0
    while cnt > 0:
        cnt -= 1
        c1, c2 = (2*left+right)//3, (left+2*right)//3

        ret1, ret2 = f(c1), f(c2)

        if ret1 > ret2:
            ans = max(ans, ret1)
            right = c2
            continue
        elif ret1 < ret2:
            ans = max(ans, ret2)
            left = c1
            continue

    print(ans)




if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

from math import floor

a, b, n = na()

x = min(b - 1, n)

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

Submission status: Accepted

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

m=0

x=min(n,b-1)
r=x//b
d=x/b-r

print(int(a*d))

Submission status: Accepted

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

max_n = min([N,B-1])
ans = (A*max_n)//B - A*(max_n//B)

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b, n = list(map(int, input().split(' ')))
x = 0
# arr = []
# for i in range(n):
#     x = i + 1
#     solve = ((a*x)//b) - a * (x//b)
#     arr.append(solve)

# print(max(arr))

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

if b == 1:
    ans = 0

print(ans)

Submission status: Accepted

Solution code:
import math
A, B, N = list(map(int, input().split()))
ans = 0
if B+1 < N:
    C = B+1
else:
    C = N
if B//A == 0:
    D = 1
elif B//A > 1:
  	D = B//A-1
else:
    D = B//A
for i in range(1, C+1, D):
    val = math.floor(A*i/B) - A*math.floor(i/B)
    #print("i", i, "val", val)
    ans = max(ans, val)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import floor

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

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

Submission status: Accepted

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

# ans = 0
# for x in range(N+1):
#     tmp = A * x // B - A * (x // B)
#     ans = max(ans, tmp)
#     print(x, A * x // B, A * (x // B), tmp)
# print(ans)

# if A < B:
if N < B:
    if N % B == 0:
        x = N-1
    else:
        x = N
        # x = (N//B)*B-1
else:
    x = (N//B)*B-1

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

Submission status: Accepted

Solution code:
A, B, N = [int(i) for i in input().split()]
if B == 1:
    max = 0
elif B > N:
    x = N
    max = ((A * x) // B) - A * (x // B)
else:
    x = N
    maxn = ((A * x) // B) - A * (x // B)
    x = B * (N // B) - 1
    maxx = ((A * x) // B) - A * (x // B)
    if maxx > maxn:
        max = maxx
    else:
        max = maxn

print(max)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from sys import stdin,stdout
input=stdin.buffer.readline

ip=[int(x) for x in input().split()]
a=ip[0]
b=ip[1]
n=ip[2]
if n<b:
	print(((a*n)//b)-a*(n//b))
else:
	x=n-(n%b)-1
	a1=((a*n)//b)-a*(n//b)
	a2=((a*x)//b)-a*(x//b)
	print(max(a1,a2))

Submission status: Accepted

Solution code:
a, b, n = map(int, input().split())
 
tmp = 0
for x in (range(1, b+1, b-2) if b<=n else range(1, n+1, n-1)):
#for x in range(1, n+1):
    calc = a*x//b - a*(x//b)
    if calc > tmp:
        tmp = calc
 
print(tmp)

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

Submission status: Accepted

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

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

else:
    answer = (A*(B-1)/B)//1 - A*(((B-1)/B)//1)

print(int(answer))

Submission status: Accepted

Solution code:
#
import sys
import math
import numpy as np
import itertools

# いくつか入力
a,b,n = (int(i) for i in input().split())

#p = a//b
#q = a-b*p
#print(p,q)
#m=0
#for x in range(0,n+1):
#    m= max(m, (a*x // b - a* (x//b) ) )#, q*x//b,q*(x//b))
#    print((a*x // b - a* (x//b) ))
#print(m)
if n >= b:
    n=b-1
m = a*n // b - a* (n//b) 

print(m)

Submission status: Accepted

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

  
print(int(m*k))

Submission status: Accepted

Solution code:
from collections import  *
def io():
    return map(int,input().split())
def op():
    return list(map(int,input().split()))
a,b,c=io()
def cal(a,b,x):
    print(((a * x) // b) - (a * (x//b)))
if c>b:
    x=c-(c%b)-1
    cal(a,b,x)
elif b==c:
    cal(a,b,b-1)
else:
    cal(a,b,c)

Submission status: Accepted

Solution code:
import math
tmp = input().split()
A = int(tmp[0])
B = int(tmp[1])
N = int(tmp[2])
Mmax = 0

if N%B == 0:
    ANS = math.floor(A*(B-1)/B)
elif N > B:
    ANS = math.floor(A*(B-1)/B)
else:
    ANS = math.floor(A*N/B)

print(int(ANS))

Submission status: Accepted

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


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

Submission status: Accepted

Solution code:
from math import floor
from typing import NoReturn


def calc_equation(a: int, b: int, x:int) -> int:
    return floor(a * x / b) - a * floor(x / b)


def main() -> NoReturn:
    a, b, n = map(int, input().split())  # type: int, int, int

    if b > n:
        print(calc_equation(a, b, n))
    else:
        print(calc_equation(a, b, b - 1))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def main():
    import sys
    import math
    sys.setrecursionlimit(10 ** 6)
    input = sys.stdin.readline
    A, B, N = [int(x) for x in input().strip().split()]
    ans = 0
    for x in range(min(N, B), max(min(N, B)-A-1, -1), -1):
        ans = max(ans, math.floor((A*x)/B)-A*math.floor(x/B), 0)
    
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
inputs = input().split(' ')
a = int(inputs[0])
b = int(inputs[1])
n = int(inputs[2]) + 1

x = (n if n < b else b) - 1
output = (a*x//b)

print(output)

Submission status: Accepted

Solution code:
A,B,N = map(int,input().split())
#N=int(input())
#A = list(map(int,input().split()))
#S=str(input())
m=0
if B<=N:
    m=int(A * (B-1) / B)
    print(m)

else:
    m=int(A * N / B)
    print(m)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import sys
def input():
    return sys.stdin.readline().rstrip('\n')

def calc(A, B, N):
    x = min(B - 1, N)
    return math.floor(A * x / B)

(A, B, N) = tuple([int(s) for s in input().split()])
print(calc(A, B, N))

Submission status: Accepted

Solution code:

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

mx = 0

nn = n//b

mm = (a*n)//b - a*(nn)

if nn > 0:
    x = b*nn-1
    mx = (a*x)//b - a*(nn-1)
    mm = max(mm, mx)
    
print(mm)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
@author: H_Hoshigi
"""
import math
A, B, N = map(int, input().split())

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

def main():
    print(f(min(N, B-1)))

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import math

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

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

if b==1:
    print(0)
elif b-1 <= n:
    print(a-math.ceil(a/b))
else:
    print(calc(a,b,n))

Submission status: Accepted

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

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

k = min(B - 1, N)
ans = (A * k - A * k % B) // B
print(ans)

Submission status: Accepted

Solution code:
a,b,n = map(int,input().split())
ans = 0
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 = [int(_) for _ in input().split()]
x = min(B - 1, N)
print((A * x) // B - A * (x // B))

Submission status: Accepted

Solution code:

import sys
from math import floor
import itertools
import collections

def solve(A,B,N):
    if(B > N):
        x = N
    else:
        x = B - 1
    return floor((A*x)/B) - A * floor(x/B)

# def solve2(A,B,N):
#     ans = 0
#     for n in range(1,N+1):
#         ans = max(ans,floor(A*n/B) - A * floor(n/B))
#         # print(n,floor(A*n/B) - A * floor(n/B))
#     return ans

def main():
    A,B,N = map(int,input().split())
    # solve()
    print(solve(A,B,N))
    # print(solve2(A,B,N))
if __name__ == '__main__':
   main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

x = 0
if n < b :
    x = n
    ans = math.floor(a*x/b)-a*math.floor(x/b)
    print(ans)
elif b <= n :
    x = b-1
    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())
i=b-1
ans=(min(n,b-1)*a)//b;
while(i<=n):
    if((i*a)//b-a*(i//b)<=ans):
        break;
    ans=max(ans,(i*a)//b-a*(i//b));
    print(ans+"\n")
    i+=b;
print(ans);

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
from sys import stdin


def get_result(data):
    A, B, N = data
    if B == 1:
        return 0
    length = N//B+1
    x = [B*(i+1)-1 for i in range(length)]
    ans = []
    for val in x:
        if val > N:
            val = N
        ans.append(math.floor(A*val/B) - A*math.floor(val/B))
    return max(ans)


if __name__ == '__main__':
    data = list(map(int, stdin.readline().rstrip().split(' ')))
    result = get_result(data)
    print(result)

Submission status: Accepted

Solution code:
import math
A,B,N = list(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) - A * math.floor((B-1) / 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, gcd
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 heapq import heappush, heappop
from functools import reduce
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)

if N < B:
	print(f(N))
else:
	k = (N-B+1)//B
	print(f(B-1+k*B))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


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

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


if __name__ == '__main__':
    resolve()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from math import *
A,B,N=[int(i) for i in input().split()]
f = lambda k:floor(A*k/B)
if B-1 < N:
    print(f(B-1))
else:
    print(f(N))

Submission status: Accepted

Solution code:
import sys
import math  # noqa
import bisect  # noqa
import queue  # noqa


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


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

    if N < B:
        res = (A * N) // B
        return print(res)

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math
mf=math.floor
a,b,n=map(int,input().split())
d=0
if n<b:
    i=n
elif n>=b:
    i=b-1
c=mf(a*i/b)-a*mf(i/b)
print(c)

Submission status: Accepted

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

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

ans = (a*n)//b - a*(n//b)

print(ans)

Submission status: Accepted

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

if B > N:
  ret = math.floor(A * N / B) - (A * math.floor(N / B))
elif B <= N:
  ret = math.floor(A * (B - 1) / B) - (A * math.floor((B - 1) / B))

print(ret)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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


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

Submission status: Accepted

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

Submission status: Accepted

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

temp = a * b // math.gcd(a, b) - 1
temp1 = n - (n % b + 1) if n%b != n else n
temp = min(temp, temp1)
#print(temp)
ans = (a * temp)//b - a * (temp//b)
print(ans)

Submission status: Accepted

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

import sys
import pprint

sys.setrecursionlimit(10 ** 6)

class Logger:
	def __init__(self, debug):
		self.debug = debug
	def print(self, *args):
		if self.debug:
			pprint.pprint(args)


def main():
	log = Logger(1)
	a, b, n = map(int, sys.stdin.readline().split())
	if n < b:
		print(int((n/b - int(n/b))*a))
	else:
		print(int(((b-1)/b - int((b-1)/b))*a))

	


main()

Submission status: Accepted

Solution code:
a,b,n=map(int,input().split())
d=((a*(n))//b)-(a*((n)//b))
e=((a*(n-1))//b)-(a*((n-1)//b))
f=0
if b < n:
    f=((a*(b-1))//b)-(a*((b-1)//b))
print(max(d,e,f))

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import math

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

c = 0
ans = 0

if N < 1000001:
  for i in range(1,N+1):
    c = int(A*i/B) - A*int(i/B)
    if ans < c:
      ans = c

elif N < B:
  ans = int(A*N/B) - A*int(N/B)
      
else:
  count = B-1
  for i in range(10000):
    c = int(A*count/B) - A*int(count/B)
    if ans < c:
      ans = c
    count += B
    
print(int(ans))

Submission status: Accepted

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

if(n>=b):
  if((n+1)%b == 0):
    q = (n+1)/b - (n+1)//b
  else:
    tmp = (n//b)*b - 1
    q = tmp/b -tmp//b
else:
  q = n/b

print(int(a*q))

Submission status: Accepted

Solution code:
A, B, N = map(int, input().split())
answer = 0
if B > N:
    mae = (A*N)//B
    usiro = A*(N//B)
    l = mae-usiro
else:
    i = (B-1)
    mae = (A*i)//B
    usiro = A*(i//B)
    l = mae-usiro
print(l)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
a, b, n = map(int, input().split())
if b <= n:
    x = b - 1
else:
    x = n
ans = (a * x) // b - x // b * a
print(ans)

Submission status: Accepted

Solution code:
def calc(x):
    if x >= 0:
        return (A*x)//B-A*(x//B)
    else:
        return 0


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

Submission status: Accepted

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

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

Submission status: Accepted

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


floor_num=[]

if N >=B:
    floor_num.append(int(A*(B-1)/B))
else:  

        floor_num.append(int(A*N/B))


print(max(floor_num))

Submission status: Accepted

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


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

Submission status: Accepted

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

c = min(n, b - 1)
for i in range(c, max(c-a-1, -1), -1):
    v = (a * i // b) - a * (i // b)
    max_v = max(max_v, v)
print(max_v)

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
A, B, N = map(int, input().split())
x = N // 2
def floor(t):
    return math.floor(t)
li = []
if B < N:
    print(floor((A*(B - 1)) / B) - A * floor((B - 1)/B))
elif B == N:
    print(floor((A*(N - 1)) / B) - A * floor((N - 1)/B))
else:
    print(floor((A*(N)) / B) - A * floor((N)/B))

Submission status: Accepted

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

Submission status: Accepted

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

# for x in range(1, 1+N):
#   l = math.floor(A*x/B)
#   r = A * math.floor(x/B)
#   print((x, l-r, l, r))

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

Submission status: Accepted

Solution code:
A, B, N = map(int, input().split())
# pre_x = list()
# ind = B-1
# while ind <= N:
#     pre_x.append(ind)
#     ind += B

# if len(pre_x) == 0:
#     ans = int(A*N/B) - A*int(N/B)
#     print(ans)
# else:
#     ans = 0
#     for x in pre_x:
#         ans = max(ans, int(A*x/B) - A*int(x/B))
    
#     print(ans)

# if B > N:
#     print(int(A*N/B) - A*int(N/B))
# else:
#     x_under = max(int())

if B > N:
    print(int(A*N/B) - A*int(N/B))
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())
if(N<B):
    x = N
else:
    x =B-1    

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

Submission status: Accepted

Solution code:
import math

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

    if n >= b:
        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))

main()

Submission status: Accepted

Solution code:
import math
a, b, n = map(int, input().split())
for i in range(a-1, -1, -1):
    if math.floor(b * i / a) + 1 < (i + 1) * b / a:
        if math.floor(b * i / a) + 1<=n:
            print(i)
            exit()
print(0)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


def solve(A: int, B: int, N: int):
    if B > N:
        x = N
    else:
        x = B - 1
    print(A * x // B)


    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
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()