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

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

Submission status: Accepted

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

Submission status: Accepted

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

def f(a, b, n):
    fl1 = (a * n) // b
    fl2 = n // b
    fl = fl1 - (a * fl2)
    return fl
   #return int(a * n / b) - a * int(n / b)

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

Submission status: Accepted

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

Submission status: Accepted

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

def f(a, b, n):
   # fl1 = (a * (n + 1)) // b
    #fl2 = (n + 1) // b
    #fl = fl1 - a * fl2
    #return fl
   return int(a * n / b) - a * int(n / b)

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

if n >= b-1:
    ans = floor(b-1)
else:
    ans = floor(n)

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

Submission status: Accepted

Solution code:
import sys
import math

sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline


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


A, B, N = map(int, input().split())
x = N
if N >= B - 1:
    x = B - 1
print(f(A, B, x))

Submission status: Accepted

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

Submission status: Accepted

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


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


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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/python3

import math
#標準出力からの読み込み
input_1 = input()
a = int(input_1.split(" ")[0])
b = int(input_1.split(" ")[1])
n = int(input_1.split(" ")[2])


#判定ロジック
score = math.floor(a/b*min(b-1, n))
print(score)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import os
import math
import bisect
import collections
import itertools

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

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


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


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

print(int(ans))

Submission status: Accepted

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

def hoge(i):
    hoge=math.floor(A*i/B)-A*math.floor(i/B)
    return hoge

if N<=B-1:
    re=hoge(N)
else:
    re=hoge(B-1)

print(re)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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

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

Submission status: Accepted

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

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

print((A * r) // B)

Submission status: Accepted

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

Submission status: Accepted

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

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

print( math.floor(( A*(div_num % B)/B )) )

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**8)
INF = float("inf")


def solve(A: int, B: int, N: int):
    # print(A/B)
    # for x in range(1, N+1):
    #     print(x % B, int(A*x/B) - A*int(x/B))

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


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    solve(A, B, N)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def floor(num):
    return int(num // 1)


def calc(i):
    return floor(A * i / B) - A * floor(i / B)


if __name__ == '__main__':
    A, B, N = map(int, input().split())
    print(calc(min(B - 1, N)))

Submission status: Accepted

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


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

Submission status: Accepted

Solution code:
import math

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

maxresult = 0

#これはタイムオーバー
#for x in range(n+1):
#    if (a * x * 1.0 // b) - a * (x * 1.0 // b) >= maxresult:
#        maxresult = (a * x * 1.0 // b) - a * (x * 1.0 // b)

#これもタイムオーバー
#for x in range(n+1):
#    if a * math.modf(x*1.0/b)[0] >= maxresult:
#        maxresult = a * math.modf(x*1.0/b)[0]

"""
解説動画を見て、再考
x = pB + qと変形する。（https://twitter.com/chokudai/status/1256806061194874881）
floor[Ax / B]
=floor[(APB+Aq) / B]
=Ap + floor[Aq / B]

A * floor[x / B]
= A * floor[(pB+q) / B]
= A * (p + floor[q/B])

よって、
floor[Ax / B] - A * floor[x / B]
=Ap + floor[Aq / B] - Ap - A * floor[q / B]
=floor[Aq / B] - A * floor[q / B]
  #x = pB + qであるため、floor[q/B] = 0
=floor[Aq / B]
  #q = (x % B)なので
=floor[A/B * (x % B)]
この値が最大になればよく、xは整数なので、
x = B-1の時が最大となる。

ただしN < B-1の場合は、x = B-1を取れないので、
そのときにはxの最大値x=Nとなる。
"""

if n < b-1:
    x = n
else:
    x = b-1
maxresult = a * (x%b) // b

print(int(maxresult))

Submission status: Accepted

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

def LI(): return list(map(int, stdin.readline().split()))
def LS(): return list(stdin.readline())

a,b,n = LI()

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

Submission status: Accepted

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

def floor(x,y):
    return int(x/y)
  
if N < B:
    x = N
else:
    x = B-1
max = floor(A*x,B) - A * floor(x,B)
print(max)

Submission status: Accepted

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

Submission status: Accepted

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

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

ans = (a*(x%b))//b
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import floor

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

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

Submission status: Accepted

Solution code:
import sys
import math
sys.setrecursionlimit(10**9)

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

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


if __name__ == "__main__":
  main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

import math

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline
from collections import defaultdict
from heapq import heappop, heappush

from decimal import *

##### リストの 二分木検索 #####
# bisect_left(lists, 3)
# bisect_right(lists, 3)

##### プライオリティキュー #####
# heapq.heapify(a) #リストaのheap化
# heapq.heappush(a,x) #heap化されたリストaに要素xを追加
# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力

# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう
# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと

##### タプルリストのソート #####
# sorted(ans) #(a, b) -> 1st : aの昇順, 2nd : bの昇順
# sorted(SP, key=lambda x:(x[0],-x[1])) #(a, b) -> 1st : aの昇順, 2nd : bの降順
# sorted(SP, key=lambda x:(-x[0],x[1])) #(a, b) -> 1st : aの降順, 2nd : bの昇順
# sorted(SP, key=lambda x:(-x[0],-x[1])) #(a, b) -> 1st : aの降順, 2nd : bの降順

# sorted(SP, key=lambda x:(x[1])) #(a, b) -> 1st : bの昇順
# sorted(SP, key=lambda x:(-x[1])) #(a, b) -> 1st : bの降順

##### 累乗 #####
# pow(x, y, z) -> x**y % z

##### 割り算の切り上げ #####
# tmp = -(-4 // 3)

##### dict の for文 #####
# for k, v in d.items():
#     print(k, v)

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
def inputStr(): return input()[:-1]

inf = float('inf')
mod = 1000000007

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

def main():
	A,B,N = inputMap()

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

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
# nCr mod m
# rがn/2に近いと非常に重くなる
def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res

# mを法とするaの乗法的逆元
def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

def egcd(a, b):
    if a == 0:
        return b, 0, 1
    else:
        g, y, x = egcd(b % a, a)
        return g, x - (b // a) * y, y

# nHr mod m
# 問題によって、combination()を切り替えること
def H(n, r, mod=10**9+7):
	# comb = Combination(n+r-1, mod)
	# return comb(n+r-1, r)
    return combination(n+r-1, r, mod)


class Combination:
    """
    O(n)の前計算を1回行うことで，O(1)でnCr mod mを求められる
    n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
    使用例：
    comb = Combination(1000000)
    print(comb(5, 3))  # 10
    """
    def __init__(self, n_max, mod=10**9+7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]
        facinv = [1]
        for i in range(1, n+1):
            fac.append(fac[i-1] * i % self.mod)
            facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n+1)
        modinv[1] = 1
        for i in range(2, n+1):
            modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
        return modinv

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
# dfs のサンプル
def dfs(graph,parent,counter,edge):
    stk = []
    stk.append(edge)
    while len(stk) > 0:
        p = stk.pop()
        for e in graph[p]:
            if parent[p] == e:
                continue
            else:
                parent[e] = p
                counter[e] += counter[p]
                stk.append(e)

if __name__ == "__main__":
	main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math

DEBUG = False

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

if DEBUG:
    ans = 0
    for x in range(1, N+1):
        term1 = math.floor(A*x/B)
        term2 = A * math.floor(x/B)
        temp = term1 - term2
        print("x: {}, temp: {}, term1: {}, term2: {}".format(x, temp, term1, term2))
        ans = max(ans, temp)
    print(ans)

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-


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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

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

if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

def X(x):
    return (A * (x % B) - A * (x % B) % B)/B

if N < B - 1:
    print(int(X(N)))
else:
    print(int(X(B-1)))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ans=0
t=min(b,n)
for i in range(t,max(t-3,-1),-1):
    ans=max(ans,((a*i)//b-(a*(i//b))))
print(ans)

Submission status: Accepted

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

print(math.floor(a*min([b-1, n])/b)-a*math.floor(min([b-1, n])/b))

Submission status: Accepted

Solution code:
A,B,N = map(int,input().split())
#よくわかわんが、ｘは、min(N, B-1)が最大になるらしい
x = min(N, B - 1)
print(A*x//B - A*(x//B))

Submission status: Accepted

Solution code:
#!/usr/bin/env Pypy3
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())
if N >= B:
    N = B-1
ans = math.floor(A*N/B) - A*math.floor(N/B)
print(ans)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
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:
n,m,k = [int(e) for e in input().split()]
mk = min (m-1,k)
a = (n * mk) // m  - n * (mk //m )
print(a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
arr = input().split(" ")
a, b, n = int(arr[0]), int(arr[1]), int(arr[2])
if b<=n:
   k = int((a*(b-1))/b)
else:
   k = int((a*n)/b)
print(k)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

def main():
    a, b, n = map(int, input().split())
    return f(min(b-1, n), a, b)

if __name__ == "__main__":
    print(main())

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

A,B,N = [int(x) for x in input().split()]
m = min(B-1,N)
print(f(A,B,m))

Submission status: Accepted

Solution code:
from sys import stdin
#n = int(stdin.readline().rstrip())
#l = list(map(int, stdin.readline().rstrip().split()))
a,b,n = map(int, stdin.readline().rstrip().split())
#S = [list(map(int, stdin.readline().rstrip().split())) for _ in range(h)]#hの定義を忘れずに

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

Submission status: Accepted

Solution code:
from math import floor


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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math

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

max_value = 0
n = min(N, B-1)

max_value =  math.floor(A*n/B) - A* math.floor(n/B)


    
print(max_value)

Submission status: Accepted

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

Submission status: Accepted

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

print(t)

Submission status: Accepted

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

a = int(s[0])
b = int(s[1])
n = int(s[2])

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

Submission status: Accepted

Solution code:
from math import floor

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

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

Submission status: Accepted

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

a = int(s[0])
b = int(s[1])
n = int(s[2])

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

Submission status: Accepted

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

ans = 0

x = min(N, B-1)

A_x = A * x
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

x = min(N, B-1)

A_x = A * x
left_ = int(A_x / B)
right_ = A * int(x / B)
fnc_ = left_ - right_
ans = fnc_

print(ans)

Submission status: Accepted

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

ans = 0

x = min(N, B-1)

A_x = A * x
left_ = int(A_x / B)
right_ = A * int(x / B)
fnc_ = left_ - right_
if x <= N:
  ans = max(ans, fnc_)
  # print("入れ替わりans", ans)

print(ans)

Submission status: Accepted

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

x = min(B-1,N)

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

Submission status: Accepted

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

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

print(ans)

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
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:
import math
A, B, N = map(int, input().split())
if N >= B:
	N = B - 1
ans = math.floor(A * N / B)
print(ans)

Submission status: Accepted

Solution code:
'''ika tako
見た目が難しそうな問題こそ、書いて考えよう
式の意味を、数字を当てはめながら、具体的に試してみよう
考察が出来れば、実装は簡単な問題もある

x  を B で割った商をd、剰余を m とすると、それぞれは以下のように表せる。
(Ax)/B=Ad+(Am)/B
A*x/B=Ad
なので、m を最大化すればよい。
m=B−1 とできるなら、それが最大となる。
N の制約のせいでできないなら、できるだけ大きい数なので、
x=N とすればよい。
'''
a, b, n = map(int, input().split())
 
if b <= n:
    print(a * (b - 1) // b)
else:
    print(a * n // b)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(int(ans))

Submission status: Accepted

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

Submission status: Accepted

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


x = 0

if N >= B - 1:
    x = B - 1
elif N < B -1:
    x = N
    if not N % B == 0:
        pass
    else:
        x -= 1


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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

x = min(B-1, N)

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def f1():
    x = B-1
    if x > N:
        x = N
    return (A * x) // B - A * (x // B)

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

print(f1())

Submission status: Accepted

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

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

    if B == 1:
        ans = 0
        print(ans)
        return

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

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

if __name__ == '__main__':
    main()
    sys.exit(0)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
A, B, N = map(int, input().split())
ans = 0
if N<10**6:
    for i in range(N+1):
        tmp = math.floor(A*i/B)-A*math.floor(i/B)
        if tmp>ans:
            ans = tmp
elif N>=10**6 and N>=B:
    ans = math.floor(A*(B-1)/B)-A*math.floor((B-1)/B)
elif N>=10**6 and N<B:
    ans = math.floor(A*N/B)-A*math.floor(N/B)
    

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

A,B,N=map(int,input().split())
print(math.floor(A/B*(~-B if N>=B else N)))

Submission status: Accepted

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

m=min(N,B-1)

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

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

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

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

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import floor
a, b, n = [int(x) for x in input().split()]
x = min(b - 1, n)
answer = floor(a * x / b) - a * floor(x / b)
print(answer)

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 sys


sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7


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


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

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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
def main():
    import sys
    line = sys.stdin.readline
    A,B,N = map(int,input().split())
    if B>N:
        ans = A*N//B
    else:
        ans = A*(B-1)//B
    print(ans)

if __name__== "__main__":
    main()

Submission status: Accepted

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

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

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

Submission status: Accepted

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

# from math import floor
# floor(A*x/B) - A*floor(x/B)
# (A*x-x%B) - A*(x-x%B)
# A*x - x%B - A*x + A*(x%B)
# x%B + A*(x%B)
# Aは定数なので x%B を最大化すればよい
# x%Bを最大化するにはxは基本的にはB-1
# NがB-1を取り得ない場合はN

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

ans = min(B-1, N)

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

Submission status: Accepted

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

Submission status: Accepted

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

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