Problem:


Score : 400 points

Problem Statement

Given are integers A, B, and N.

Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non-negative integer x not greater than N.

Here floor(t) denotes the greatest integer not greater than the real number t.

Constraints

1 ≤ A ≤ 10^{6}

1 ≤ B ≤ 10^{12}

1 ≤ N ≤ 10^{12}

All values in input are integers.

Input

Input is given from Standard Input in the following format:

A B N

Output

Print the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non-negative integer x not greater than N, as an integer.

Sample Input 1

5 7 4

Sample Output 1

2

When x=3, floor(Ax/B)-A×floor(x/B) = floor(15/7) - 5×floor(3/7) = 2. This is the maximum value possible.

Sample Input 2

11 10 9

Sample Output 2

9



Sample input:
5 7 4


Sample output:
2

Submission status: Accepted

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

from math import floor

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from math import factorial, sqrt, ceil, gcd
from functools import lru_cache, reduce
INF = 1 << 60
MOD = 1000000007
sys.setrecursionlimit(10 ** 7)

# UnionFind
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

# ダイクストラ
def dijkstra_heap(s, edge, n):
    #始点sから各頂点への最短距離
    d = [10**20] * n
    used = [True] * n #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d

# 素因数分解
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

# 2数の最小公倍数
def lcm(x, y):
    return (x * y) // gcd(x, y)

# リストの要素の最小公倍数
def lcm_list(numbers):
    return reduce(lcm, numbers, 1)

# リストの要素の最大公約数
def gcd_list(numbers):
    return reduce(gcd, numbers)

# 素数判定
def is_prime(n):
    if n <= 1:
        return False
    p = 2
    while True:
        if p ** 2 > n:
            break
        if n % p == 0:
            return False
        p += 1
    return True


# limit以下の素数を列挙
def eratosthenes(limit):
    A = [i for i in range(2, limit+1)]
    P = []

    while True:
        prime = min(A)
        
        if prime > sqrt(limit):
            break
            
        P.append(prime)
            
        i = 0
        while i < len(A):
            if A[i] % prime == 0:
                A.pop(i)
                continue
            i += 1
            
    for a in A:
        P.append(a)
            
    return P

# 同じものを含む順列
def permutation_with_duplicates(L):

    if L == []:
        return [[]]

    else:
        ret = []

        # set（集合）型で重複を削除、ソート
        S = sorted(set(L))

        for i in S:

            data = L[:]
            data.remove(i)

            for j in permutation_with_duplicates(data):
                ret.append([i] + j)

        return ret


# ここから書き始める
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())
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 sys
a, b, n = map(int, sys.stdin.readline().split())
if b-1 >= n:
  s = (a*n)//b - a*(n//b)
else:
  s = (a*(b-1))//b - a*((b-1)//b)
print(s)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

ans = 0

i = min(b-1,n)

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

print(ans)

Submission status: Accepted

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

x=min(B-1,N)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import time
start=time.time()
A,B,N=[int(s) for s in input().split()]
x=((N+1)//B)*B-1
ans=set()
ans.add((A*N)//B-A*(N//B))
while x>0:
  ans.add((A*x)//B-A*(x//B))
  x-=B
  if (time.time()-start)>1.7:
    break
print(max(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
mod = 10**9+7
import sys
from collections import Counter, defaultdict, deque
from itertools import product, permutations, combinations
from itertools import accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from math import ceil,floor
from copy import deepcopy
from heapq import heappop,heappush,heapify
import heapq


# l = ['a', 'a', 'a', 'a', 'b', 'c', 'c']
# c = Counter(l)

# d = defaultdict(int)

sys.setrecursionlimit(10 ** 6)

int1 = lambda x: int(x) - 1

# リストの要素を改行を挟んで表示する
p2D = lambda x: print(*x, sep="\n")
# 入力を整数に変換して受け取る
def II(): return int(sys.stdin.readline())

def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())

# 入力全てを整数に変換したものの配列を受け取る
# def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI(): return list(map(lambda x:int(x), sys.stdin.readline().split()))
def HI(): return list(map(lambda x:int(x)*(-1), sys.stdin.readline().split()))



a,b,n = MI()
i = min(n,b-1)
tmp = floor((a*i)/b) - a*floor(i/b)
print(tmp)

# n,m,q = MI()
# A =[]
# B = []
# C = []
# D = []

# for _ in rage(q):
# 	a,b,c,d = MI()
# 	A.append(a)
# 	B.append(b)
# 	C.append(c)
# 	D.append(d)

# for i in range(n):

Submission status: Accepted

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


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


if __name__  == '__main__':
    main()

Submission status: Accepted

Solution code:
A,B,N=[int(i) for i in 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:
def main():
    A, B, N = map( int, input().split())
    def calc(x):
        return A*x//B-x//B*A

    if N < B:
        print(calc(N))
    else:
        print(calc(B-1))
if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import floor

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

a,b,n = map(int, input().split())
res = -10**9
for x in range(max(min(n,b)-100,0),min(n,b)+1):
    res = max(res, f(a,b,x))
print(res)

Submission status: Accepted

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


if __name__ == '__main__':
    resolve()

Submission status: Accepted

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

Submission status: Accepted

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

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

if b>n:
    print(f(n))
    exit()

print(f(b-1))

Submission status: Accepted

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

x = min(N, B - 1)

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

# floor( Ar / B ) : r = 0..min(B-1,N%B)

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

print( A*r // B )

Submission status: Accepted

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

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

# 改行またはスペース区切りの入力をすべて読み込んでイテレータを返します。
def get_all_int():
    return map(int, open(0).read().split())

def rangeI(it, l, r):
    for i, e in enumerate(it):
        if l <= i < r:
            yield e
        elif l >= r:
            break

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

MOD = 10**9+7

a,b,n = get_nums_l()

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

def solve(a,b,n):
    m = -999999999999
    mi = 0
    for x in range(n+1):
        y = f(a,b,x)
        if m < y:
            m = y
            mi = x
    return m,mi

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

Submission status: Accepted

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


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

Submission status: Accepted

Solution code:
from math import floor

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

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

Submission status: Accepted

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

ans = 0

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from math import floor

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

Submission status: Accepted

Solution code:
import math

ABN = list(map(int, input().split()))

#xがBの倍数であれば全体が0
#その一個手前が最大値

if (ABN[2] >= ABN[1]):
    print(math.floor(ABN[0] * (ABN[1] - 1) / ABN[1]))
else:
    print(math.floor(ABN[0] * ABN[2] / ABN[1]) - ABN[0] * math.floor(ABN[2] / ABN[1]))

Submission status: Accepted

Solution code:
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
from math import floor

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    A, B, N = map(int, rl().split())
    
    if N < B:
        ans = floor(A * N / B) - A * floor(N / B)
    else:
        ans = floor(A * (B - 1) / B) - A * floor((B - 1) / B)
    print(ans)


if __name__ == '__main__':
    solve()

Submission status: Accepted

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

from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
from collections import deque, defaultdict
from itertools import combinations, permutations
from itertools import accumulate
from math import ceil, sqrt, pi

MOD = 10 ** 9 + 7
INF = 10 ** 18


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

def f(x):
    return (A * x) // B - A * (x // B)
    
#for x in range(1, N + 1):
#    print(f(x))
    
if N >= B - 1:
    print(f(B - 1))
else:
    print(f(N))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")

#solve
def solve():
    a, b, n = LI()
    print(min(b - 1, n) * a // b)
    return


#main
if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
[A,B,N] = [int(s) for s in input().rstrip().split(' ')]
if B == 1:
    print(0)
elif N < B:
    print(A*N//B)
else:
    print((A*(B-1))//B)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

print(math.floor(A * (x/B - int(x/B))))

Submission status: Accepted

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

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
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 main():
    a, b, n = LI()
    print(a*min((b-1), n) // b)


main()

Submission status: Accepted

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

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

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

Submission status: Accepted

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

i = (N+1)//B
x = max(0,i*B - 1)
print(max((A*x)//B - A * (x//B), (A*N)//B - A * (N//B)))

Submission status: Accepted

Solution code:
import sys

def solve():
    input = sys.stdin.readline
    A, B, N = map(int, input().split())
    print(A * min(N, B - 1) // B)
    return 0

if __name__ == "__main__":
    solve()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

# sys.setrecursionlimit(100000)
input = sys.stdin.buffer.readline
INF = 2**62-1

def read_int():
    return int(input())


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(A, B, N):
    x = min(B - 1, N)
    ans = A*x//B - A*(x//B)
    return ans


def main():
    A, B, N = read_int_n()
    print(slv(A, B, N))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math

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

def a():
    global A,B,N,x
    print(math.floor(A*x/B)-A*math.floor(x/B))

x = min(B-1,N)
a()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sat May  2 20:59:19 2020
"""

import sys
#import numpy as np

sys.setrecursionlimit(10 ** 9)
#def input():
#    return sys.stdin.readline()[:-1]
mod = 10**9+7

#N = int(input())
A, B, N = map(int,input().split())
#A = list(map(int,input().split()))
#graph = [[] for _ in range(N+1)]
#for _ in range(N-1):
#    a, b = map(lambda x : int(x)-1, input().split())
#    graph[a].append(b)
#    graph[b].append(a)

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

Submission status: Accepted

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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache

import heapq


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#############
# Main Code #
#############

A,B,N = inputIL()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
import collections
from collections import deque
from functools import reduce
import heapq
#x = int(input())
a, b, n = map(int, sys.stdin.readline().split())
#s = input()
#a = list(map(int, sys.stdin.readline().split()))

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

    
if b > n:
    print(calc(n))
else:
    print(calc(b-1))

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 sys

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

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

#for x in range(1, 100):
	#print(x, f(x))

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

if b == 1:
    ans = 0

print(ans)

Submission status: Accepted

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

import math

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

Submission status: Accepted

Solution code:
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    A,B,N=map(int,readline().split())

    if N>=B:
        x=B-1
        print(A*x//B)
    else:
        x=N
        print(A*x//B)
if __name__=="__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
"""n,m,q = (int(i) for i in input().split())
a = []
ans = 0

for i in range(q):
	a.append(list(map(int,input().split())))

for i in range(q):
	if
		ans+=a[i][3]

print(ans)
"""

a,b,n = (int(i) for i in input().split())
x = 0
if b<=n:
	x = b-1
else:
	x = n
c = a*x
print(c//b)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
input = sys.stdin.readline

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

def main():
    A, B, N = map(int, input().split())
    d = math.gcd(A,B)
    #if d == 1: # 互いに素
    x = min(N,B-1)
    print(math.floor(A*x/B)-A*math.floor(x/B))

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if B>N:
	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())

x = min(n, b - 1)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import bisect
import collections
import sys

sys.setrecursionlimit(100000)
input = sys.stdin.readline
ACMOD = 1000000007
INF = 1 << 62


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


def llmi(n):
    return [lmi() for _ in range(n)]


A, B, N = lmi()
# (A*(x%B) - (A*x)%B )/B

# if N < B:
#     ans = -INF
#     for i in range(1, N + 1):
#         ans = max(ans, (A * (i % B) - (A * i) % B) // B)
#     print(ans)
#     exit()
#
i = min(B - 1,N)
print((A * (i % B) - (A * i) % B) // B)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

t = A // B
p = A % B

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

print (t*q + p*q//B)

Submission status: Accepted

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

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

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

ans = int(a*c/b)
print(ans)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import floor
import sys
input = sys.stdin.readline
A,B,N=(int(x) for x in input().rstrip('\n').split())
if N < B:
  print(floor(A*N/B))
else:
  print(floor(A*(B-1)/B))

Submission status: Accepted

Solution code:
from collections import defaultdict,deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp():
    '''
    一つの整数
    '''
    return int(input())
def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))


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

Submission status: Accepted

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

if n < b:
  x = n
  print(int(a*x/b) - a * int(x/b))
  exit()
elif n >= b:
  x = b-1
  print(int(a*x/b) - a * int(x/b))
  exit()