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

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

if A % B == 0:
    print(0)

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

Submission status: Accepted

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

def tgt(A,B,d):
    return math.floor(A * d / B)

if N >= B-1:
    d_max = B-1
else: # N< B-1
    d_max = N

ret = tgt(A,B,d_max)

print(ret)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=list(map(int, input().split()))
A=a[0]
B=a[1]
N=a[2]
if B-1<N:
    i=int(A*(B-1)/B)-A*int((B-1)/B)
else:
    i=int(A*N/B)-A*int(N/B)
print(i)

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

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

Submission status: Accepted

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

Submission status: Accepted

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

x = min(b - 1, n)

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

print(f(x))

Submission status: Accepted

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

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

Submission status: Accepted

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

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

left = -1
right = N
def check(x):
    global A, B
    return math.floor(A * x / B) - A * math.floor(x / B)

if B <= N:
    print(check(B - 1))
else:
    print(check(N))

Submission status: Accepted

Solution code:
a, b, n = map(int, input().split())
# for x in range(n + 1):
#     t1 = (a * x) // b
#     t2 = a * (x // b)
#     print(t1 - t2)
# print("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")

if a <= b:
    if n >= b - 1: print(a - 1)
    else:
        x = n - 1
        t1 = (a * x) // b
        t2 = a * (x // b)
        print(t1 - t2)
else:
    ans = -1
    for x in range(min(n + 1, a + 1)):
        t1 = (a * x) // b
        t2 = a * (x // b)
        ans = max(ans, t1 - t2)
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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:
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 = map(int, input().split())
val = (a*n)//b - a*(n//b)
m = max(0,(n//b)*b-1)
val = max(val, (a*m)//b - a*(m//b))
print(val)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
import fractions
from collections import deque
from collections import defaultdict
sys.setrecursionlimit(10**7)

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

# m = -1

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

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

Submission status: Accepted

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


#ｘがB-1の時の値を求めればよい。
#ただし、NがB-1より小さいときはXがNの時を算出する。

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

ans1 = (A*x) // B    
ans2 = A*((x) // B)

ans = ans1 - ans2    



print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = list(map(int, input().split()))
a = s[0]
b = s[1]
n = s[2]

if n >= b:
    n = b - 1

kotae = round(a * ((n / b) - (n // b)) - ((a * n / b) - ((a * n) // b)))

print(kotae)

Submission status: Accepted

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

Submission status: Accepted

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

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:
#! python3
import math
def main():
    a, b, n =map(int, input().split())
    if b > n:
        ans = (math.floor(a*n/b) -a*math.floor(n/b))
    else :
        c = b-1
        ans = (math.floor(a*c/b) -a*math.floor(c/b))

    print(ans)

main()

Submission status: Accepted

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

if B > N:
    tmp = N

else:
    tmp = B -1

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

print(ans)

Submission status: Accepted

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

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:
# coding: utf-8
A,B,N=map(int,input().split())

min_x = 1
max_x = N

def f(x):
    y = (A*x)//B - A*(x//B)
    return y
    
ans=f(min(B-1,N))
print(ans)

Submission status: Accepted

Solution code:
# import sys
# import math #sqrt,gcd,pi
# import decimal
# import queue # queue
# import bisect
# import heapq # priolity-queue
# import time
# from itertools import product,permutations,\
#     combinations,combinations_with_replacement
# 重複あり順列、順列、組み合わせ、重複あり組み合わせ
# import collections # deque
# from operator import itemgetter,mul
# from fractions import Fraction
# from functools import reduce

mod = int(1e9+7)
INF = 1<<29
lINF = 1<<35

def readInt():
    return list(map(int,input().split()))

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

if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
#!python3

iim = lambda: map(int, input().rstrip().split())

def resolve():
    A, B, N = iim()

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

if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
import sys
from random import choice,randint
inp=sys.stdin.readline
out=sys.stdout.write
flsh=sys.stdout.flush
 
sys.setrecursionlimit(10**9)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
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 MI(): return map(int, inp().strip().split())
def LI(): return list(map(int, inp().strip().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines().strip()]
def LI_(): return [int(x)-1 for x in inp().strip().split()]
def LF(): return [float(x) for x in inp().strip().split()]
def LS(): return inp().strip().split()
def I(): return int(inp().strip())
def F(): return float(inp().strip())
def S(): return inp().strip()
def pf(s): return out(s+'\n')
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():
    from math import floor
    a,b,n=MI()
    if b>n:
        ans = floor((a*n)/b)
        print(ans)
    else:
        ans = floor((a*(b-1)/b))
        print(ans)
        # for i in range(1,n+1):
        #     ans = floor((a*i)/b)-a*floor((i)/b)
        #     print(ans,i)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

a, b, N = MAP()

# for x in range(N+1):
#     print(a*x // b - a*(x//b))

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
import math
import sys
sys.setrecursionlimit(10**9)
A,B,N= map(int,input().split())


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


ans = (A*x)//B

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from math import floor

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

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

result = 0
for x in range(min(A + 1, N + 1)):
    result = max(result, f(x))

if B > A:
    for i in range(10 ** 20):
        x = (i * B + A - 1) // A
        if x > N:
            break
        result = max(result, f(x))

print(result)

Submission status: Accepted

Solution code:
import math
A,B,N = map(int,input().split())
x = 0
# Bに対して一番余剰が大きくなる数字をとりたい
if B <= N:
    x = B-1
else:
    x = 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 b>n:
  print((a*n)//b-a*(n//b))
else:
  print((a*(b-1))//b)

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python
import math

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

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

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

if __name__ == '__main__':
    main()

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

if N // B == 0:
    f, _ = math.modf(N / B)
    ans = math.floor(A * f)
else:
    n = (N // B) * B - 1
    f1, _ = math.modf(n / B)
    f2, _ = math.modf(N / B)
    f = max(f1, f2)
    ans = math.floor(A * f)

print(ans)

Submission status: Accepted

Solution code:
A, B, N = list(map(int, input().split()))
# for i in range(1, N+1):
#     print("i: ", i)
#     print("{} - {} * {}".format(str(A*i/B), str(A), str(i/B)))
#     res = (A*i // B) - A * (i // B)
#     print("result: ", res)
res = (A*N // B) - A * (N // B)
if N >= B:
    t = N // B * B - 1
    tmp = (A*t // B) - A * (t // B)
    res = max(res, tmp)
print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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

result = -1

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

x = min([n, b - 1])
result = f(a, b, x)
print(result)

Submission status: Accepted

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

possible_num = B-1

if possible_num > N:
    possible_num = N
possible_ans = (A*possible_num)//B - A * (possible_num//B)

print(possible_ans)

Submission status: Accepted

Solution code:
# coding: utf-8
import sys

stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip() # ignore trailing spaces


def floor(a,b):
    return int(a//b)


def main():
    a,b,n = na()
    if n >= b-1:
        x = b-1
    else:
        x = n
    print(floor(a*x,b) - a*floor(x,b))
    return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys;input=lambda:sys.stdin.readline().rstrip();aint=lambda:int(input());ints=lambda:list(map(int,input().split()))
import math;floor,ceil=lambda x:int(math.floor(x)),lambda x:int(math.ceil(x))

def main():
  a,b,n=ints()
  flr=lambda a,b,x:floor(a*x/b)-a*floor(x/b)
  if n>=b:
    print(flr(a,b,b-1))
  else:
    print(flr(a,b,n))

if __name__ == '__main__':
    main()

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 = (int(val) for val in input().split(' '))

x = b-1 if b-1 < n else 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:
import math
A, B, N = map(int,input().split())

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import floor

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

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

    print(floor(a*x/b))

if __name__ == '__main__':
    main()

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:
#!/usr/bin/env python
from collections import deque, defaultdict
from itertools import combinations, combinations_with_replacement
import bisect
from math import factorial, sqrt, log, ceil, floor

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys;input=lambda:sys.stdin.readline().rstrip();aint=lambda:int(input());ints=lambda:list(map(int,input().split()))
import math;floor,ceil=lambda x:int(math.floor(x)),lambda x:int(math.ceil(x))
from functools import reduce;gcd=lambda*x:reduce(math.gcd,x);lcm=lambda*x:reduce(lambda x,y:(x*y)//gcd(x,y),x,1)
from collections import deque
Yes=lambda b:print("Yes"if b else"No");YES=lambda b:print("YES"if b else"NO")
is_even=lambda x:True if x%2==0 else False

def is_palindrome(s):
  n=len(s);b=True
  for i in range(int(0.5*n)):
    if s[i]!=s[n-i-1]:b=False
  return b

def main():
  a,b,n=ints()
  flr=lambda a,b,x:floor(a*x/b)-a*floor(x/b)
  if n>=b:
    print(flr(a,b,b-1))
  else:
    print(flr(a,b,n))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math
a= list(map(int,input().split()))
A=a[0]
B=a[1]
N=a[2]
if(N<B):
    x=N
else:
    x=B-1
print(math.floor(A*x/B)-A*math.floor(x/B))

Submission status: Accepted

Solution code:
from sys import stdin
from sys import setrecursionlimit
import math

a,b,n = map(int,stdin.readline().rstrip().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))

Submission status: Accepted

Solution code:
import sys
import math
import itertools 
stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

A,B,N=nm()

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

Submission status: Accepted

Solution code:
def input_int_list():
    return [int(thing) for thing in input().split(" ")]

def int_input():
    return int(input())


def print_ans(string):
    print(string)
    exit()

def yes():
    print("Yes")
    exit()

def no():
    print("No")
    exit()

if __name__ == '__main__':
    A,B,N=input_int_list()
    x=min(B-1,N)
    ans=A*x//B-A*(x//B)
    print_ans(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(700000)

def s_in():
    return input()

def n_in():
    return int(input())

def l_in():
    return list(map(int, input().split()))

def print_l(l):
    print(' '.join(map(str, l)))

class Interval():
    def __init__(self, li):
        self.li = li
        self.n = len(li)
        self.sum_li = [li[0]]
        for i in range(1, self.n):
            self.sum_li.append(self.sum_li[i-1] + li[i])

    def sum(self, a, b=None):
        if b is None:
            return self.sum(0, a)

        res = self.sum_li[min(self.n-1, b-1)]
        if a > 0:
            res -= self.sum_li[a-1]
        return res

a,b,n = l_in()

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 calc(a, b, input):
    return (a * input) // b - a * (input // b)


if n >= b:
    print(calc(a, b, b - 1))
    exit(0)
else:
    print(calc(a, b, n))
    exit(0)

Submission status: Accepted

Solution code:
import math

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

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

c = x / b - math.floor(x / b)

print(math.floor(a * c))

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:
#!/usr/bin/env python3
import sys
import math


def solve(A: int, B: int, N: int):
    # for x in range(N):
    #     math.floor(A * x / B) - A * math.floor(x / B)
    x = min(B - 1, N)
    print(math.floor(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()

Submission status: Accepted

Solution code:
from heapq import heappush, heappop
from itertools import permutations, accumulate, combinations
from math import pi, ceil, floor
import numpy as np
from collections import defaultdict, deque,Counter
from operator import itemgetter
from bisect import bisect_left, bisect_right, insort_left, insort_right
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10 ** 6)
# MOD = 10 ** 9 + 7
# INF = float("inf")


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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

a,b,n=n1()

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,n=map(int,input('').split(' '))
r=0
m=0
r=b-1
if r>=n:
    r=n
else:
    r=r

s=int(a*r/b)
print(int(a*r/b))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import floor

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

if __name__ == '__main__':
    resolve()

Submission status: Accepted

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

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

Submission status: Accepted

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

m = A - 1
for i in range(A):
    lim = [B*(A-i-1)/A, B*(A-i)/A]
    if lim[0] > N:
        m -= 1
        continue
    else:
        num = int(lim[0])
        is_found = False
        while True:
            if num >= lim[0] and num < lim[1]:
                is_found = True
                break
            elif num >= lim[1]:
                break
            else:
                num += 1
        if is_found:
            break
        else:
            m -= 1
            continue
print(m)

Submission status: Accepted

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

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

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())
m = 0
x = n
if b <= n:x = b-1
print((a*x//b))

Submission status: Accepted

Solution code:
#dt = {} for i in x: dt[i] = dt.get(i,0)+1
#dt = {k:v for k,v in sorted(x.items(), key=lambda i: i[1])}
ipnl = lambda n: [int(input()) for _ in range(n)]
inp = lambda :int(input())
ip = lambda :[int(w) for w in input().split()]
mp = lambda :map(int,input().split())

a,b,n = mp()
x = max(n,min(n,b-1))
ans1 = a*x//b - a*(x//b)

x = min(n,b-1)
ans2 = a*x//b - a*(x//b)
print(max(ans1,ans2))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main(a: int, b: int, n: int):
    ans = 0
    for i in (1, min(n, b - 1)):
        f = int((a * i) / b) - a * int(i / b)

        if ans < f:
            ans = f

    print(ans)


if __name__ == "__main__":
    a, b, n = map(int, input().split())
    main(a, b, n)

Submission status: Accepted

Solution code:
#abc 165
# d
a,b,n = map(int,input().split())
nmax = 0

# for i in range(0,min(b,n+1)):
#     ni = int(a*i/b)
#     if ni > nmax:
#         nmax = ni
# print(nmax)

q = min(b-1,n)
ni = int(a*q/b)
if ni > nmax:
        nmax = ni
print(nmax)

Submission status: Accepted

Solution code:
A, B, N = map(int, input().split())
ans = max((A*N)//B - A*(N//B), 0)

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

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

Submission status: Accepted

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

if b == 1:
    print(0)
    exit()

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
#n=int(input())
a,b,n=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(q)]

#for i in range(n+1):
#    print(i,(a*i/b)//1,a*((i/b)//1),(a*i/b)//1-a*((i/b)//1))
i=min(b-1,n)
print(int((a*i/b)//1-a*((i/b)//1)))

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

l = None
if B <= N:
    l = B-1
else:
    l = N
#print('len: ', len(l))


'''
for x in range(1, len(l) + 1):
    l[x-1] = ((A*x)//B) - A*(x//B)
'''

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



'''m = 0
for x in range(1, N+1):
    j =  ((A*x)//B) - A*(x//B)
    m = max(m,j)


print('MAX',m)
'''

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)
"""
for i in range(N+1):
    print(i, func(i))
"""

#exit()
if N >= B:

    print(func(B-1))
else:
    print(func(N))

Submission status: Accepted

Solution code:
# D - Floor Function

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 = [int(x) for x in input().split()]
import math,bisect
if b>n:
    i = n
    x = math.floor(a*i/b)-math.floor(i/b)*a
    print(x)
else:
    x = math.floor(a*(b-1)/b)
    print(x)

Submission status: Accepted

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

Submission status: Accepted

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

if N / B >= 1:
    r = B - 1
else:
    r = N

print(int(A*r/B))

Submission status: Accepted

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

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

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