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

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

elif(n>=b):
    ans = int(a*(b-1)/b) - a * int((b-1)/b)
    print(ans)

Submission status: Accepted

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

def floor(x):
    return int(x)

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

Submission status: Accepted

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

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

ans = 0

#bがnよりも大きい時
if b > n:
    ans = int(a*n/b)
    print(ans)
    exit()

#b==nのときは、終了間際の2個だけ比較する
elif b == n:
    for i in range(n-1,n+1):
        tmpans = int(a*i/b) - (a*int(i/b))
        if tmpans >= ans:
            ans = tmpans
    print(ans)
    exit()

#これ以外の時は、nはb値ごとにスキップする。
else:
    for i in range(int(n/b),n+1,b):
        tmpans = int(a*(i-2)/b) - (a*int((i-2)/b))
        if tmpans >= ans:
            ans = tmpans

print(ans)

Submission status: Accepted

Solution code:
import fractions

def gcd(a, b):
    while b:
        a, b = b, a%b
    return a


def reduce(p, q):
    common = fractions.gcd(p, q)
    return (p // common, q // common)


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

#if a != b:
#    a,b = reduce(a,b)
    

#print(a,b)

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


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

#print(a,b,x)
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import numpy as np
import pprint
import math

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

s = min(n, b - 1)
ans = math.floor(a * s / b) - a * math.floor(s / b)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def f(a, b, x):
    return (a*x)//b - a*(x//b)
def main():
    a, b, n = map(int, readline().split())
    if n < b:
       ans = f(a, b, n) 
    else:
        ans = f(a, b, b-1)
    print(ans)
if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

ans = f(a,b,b-1)
if (n < b):
	ans = f(a,b,n)
	if (ans == 0 and n > 1):
		ans = f(a,b,n-1)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from math import floor

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

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

ans = None
a_max = None

for _x in range(1):
    x = min((B - 1), N) * (_x+1)
    if x > N:
        break
    # print(x)
    a = x/B-int(x / B)
    # print(int(a * A))
    sa = int(a*A)
    # s = int((A * x) / B) - A * int(x / B)
    if a_max == None:
        a_max = sa
    elif sa > a_max:
        a_max = sa

print(a_max)

Submission status: Accepted

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

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

def lcm(a,b):
    if a < b:a,b = b,a
    while a%b != 0:
        a,b = b,a%b
    return b

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

Submission status: Accepted

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

max=0
if N>B:
  N=B-1
  y=math.floor(A*N/B)-A*math.floor(N/B)
  print(int(y))
elif N==B:
  N=B-1
  y=math.floor(A*N/B)-A*math.floor(N/B)
  print(int(y))
else:
	y=math.floor(A*N/B)-A*math.floor(N/B)
	print(int(y))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 5 + 10)


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


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

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

    p, mod = divmod(n, b)
    if mod == 0:
        print(main(n - 1))
    else:
        if p==0:
            print(main(n))
        else:
            ans = main(p * b - 1)
            print(max(main(n), ans))


resolve()

Submission status: Accepted

Solution code:
# coding: utf-8
import re
import math
from collections import defaultdict
import itertools
from copy import deepcopy
import random
from heapq import heappop,heappush
import time
import os
import queue
import sys
import datetime
from functools import lru_cache
#@lru_cache(maxsize=None)
readline=sys.stdin.readline
sys.setrecursionlimit(2000000)
#import numpy as np
alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def is_power(a,b):#aはbの累乗数か
    now=b
    while now<a:
        now*=b
    if now==a:return True
    else:return False
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def get_facs(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:
        return num
def get_primes(n,type="int"):
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=2):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def ifelse(a,b,c):
    if a:return b
    else:return  c
def join(A,c=" "):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s
def factorize(n,type_="dict"):
    b = 2
    list_ = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            list_.append(b)
        b+=1
    if n > 1:list_.append(n)
    if type_=="dict":
        dic={}
        for a in list_:
            if a in dic:
                dic[a]+=1
            else:
                dic[a]=1
        return dic
    elif type_=="list":
        return list_
    else:
        return None
def floor_(n,x=1):
    return x*(n//x)
def ceil_(n,x=1):
    return x*((n+x-1)//x)
def hani(x,min_,max_):
    ret=x
    if x<min_:ret=min_
    if x>max_:ret=max_
    return ret
def seifu(x):
    return x//abs(x)
###################################################

def main():
    A,B,N=map(int,input().split())
    G=[]
    prev=-inf
    if N<B:
        print((A*N)//B-A*(N//B))
    else:
        print((A*(B-1))//B-A*((B-1)//B))
main()

Submission status: Accepted

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

# A, B, N = 11, 10, 9
T = N//B
maxR = -1
maxT = 0
# for x in range(1, T+2):
    # t = min(x*B-1,N)
    # R = math.floor(A*t/B) - A * math.floor(t/B)
    # if R >= maxR:
    #     maxR = R
    #     maxT = t
t = min(B-1,N)
maxR = math.floor(A*t/B) - A * math.floor(t/B)
print (maxR)

Submission status: Accepted

Solution code:
import math

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

m = 0
x = n

while x >= n-b:
    if m > (a*x) // b:
        break
    else:
        y =  math.floor((a * (x / b - math.floor(x / b))))
        if m < y:
            m = y
            x = b * math.floor(x / b) - 1
        else:
            x-=1  

print(m)

Submission status: Accepted

Solution code:
A, B, N = map(int, input().split())
if B == 1:
    print(0)
    exit()

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


if B >= N:
    print(max(int(A*N/B) - A*int(N/B), int(A*(N-1)/B) - A*int((N-1)/B),int(A*(N-2)/B) - A*int((N-2)/B)))
    exit()

else:
    print(max(int(A*N/B) - A*int(N/B), int(A*(N-1)/B) - A*int((N-1)/B), int(A*(B-1)/B) - A*int((B-1)/B)))
    exit()

Submission status: Accepted

Solution code:
A,B,N=map(int,input().split())
def f(x):
    return ((A*x)//B)-A*(x//B)
if N<=10**6:
    ans=0
    for x in range(1,N+1):
        ans=max(ans,f(x))
    print(ans)
elif B<=10**6:
    ans=0
    for x in range(1,min(B+1,N+1)):
        ans=max(ans,f(x))
    print(ans)
elif B>=A:
    x=0
    ans=0
    y=0
    while(x<=N):
        ans=max(ans,f(x))
        y+=1
        x=-((-B*y)//A)
    print(ans)
else:
    ans=0
    for x in range(1,min(B+1,N+1)):
        ans=max(ans,f(x))
    print(ans)

Submission status: Accepted

Solution code:
l = list(map(int, input().split()))
x = min(l[1]-1, l[2])
r = int(l[0] * x/l[1]) - l[0] * int(x /l[1])
print(r)

Submission status: Accepted

Solution code:
import math
a,b,n=map(int,input().split())
if n>=b: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())
def floor(x):
  return int(x//1)
list = []
if N >= B:
    list.append(floor((A*(B-1))/B)-(A*floor((B-1)/B)))
else:
    list.append(floor((A*N)/B)-(A*floor(N/B)))
print(max(list))

Submission status: Accepted

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

A = int(s[0])
B = int(s[1])
N = int(s[2])

result = 0

n = (N // B) * B - 1
if (n < 0):
  n = 0

a = (A*N)//B - A*(N//B)
b = (A*n)//B - A*(n//B)
"""
for x in range(N+1):
  y = (A*x)//B - A*(x//B)
  if y > result:
    result = y
"""
    
if (a > b):
  result = a
else:
  result = b
print(result)

Submission status: Accepted

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

if(n<b):
    ma = (a*n)//b - (a* (n//b))
else:
    ma = (a*(b-1))//b - (a*((b-1)//b))
    """
    for x in range(b,n+1):
        
        num = (a*x)//b - (a*(x//b))
        if(ma > num):
            break
        ma = num
    """

print(ma)

Submission status: Accepted

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

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

l = int(A*m/B)-A*int(m/B)
print(l)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC165c


def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10 ** 6)
    from math import floor
    # 再帰関数を使わない限りPypyで出すこと

    def dump(*args):
        sys.stderr.write(str(args))

    a, b, n = map(int, input().split())
    last = -1
    ans = -1

    def evaluate(number):
        return floor(a * number / b) - a * floor(number / b)

    # for i in range(1, n+1):
    #    print(i, evaluate(i))
    print(max(evaluate(min(b, n)), evaluate(min(b-1, n))))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
A, B, N = map(int, input().split())
Smx = 0
if B<N:
    N = B
for i in range(N,0,-1):
    if i<N-A:
        break
    S = int((A*(i % B) - ((A*i) % B))/B)
    if Smx<S:
        Smx = S
print(Smx)

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:
c=list(map(int,input().split()))
bunsi=c[0]
bunbo=c[1]
n=c[2]
k=n//bunbo
d=[n]
if k>=1:
    d.append(bunbo-1)
    d.append(bunbo*k-1)
#dの中には候補となるxが入った
def floor(x):
    return ((bunsi*x)//bunbo)-(bunsi*(x//bunbo))
if len(d)>=2:
    print(max(floor(d[0]),floor(d[-1]),floor(d[-2])))
if len(d)==1:
    print(floor(d[0]))

Submission status: Accepted

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
a, b, n = map(int, input().split())
def func(i, j, k):
    return (i*k)//j - i*(k//j)
m = min(n, b-1)
r = (a*min(n, b-1)) // b
while ((a*m) // b) == r:
    m -= 1
print(func(a, b, m+1))

Submission status: Accepted

Solution code:
#template
def inputlist(): return [int(k) for k in input().split()]
A,B,N = inputlist()
k = min(N,B-1)
ans = int(A*k/B)
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8


def solve(*args: str) -> str:
    a, b, n = map(int, args[0].split())

    return str(a*min(b-1, n)//b)


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))

Submission status: Accepted

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

Submission status: Accepted

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

c = min([B - 1, N])
y = (A * c - ((A * c) % B)) // B

print(y)

Submission status: Accepted

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

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

result = int(A * x / B) - A * int(x / B)

print(result)

Submission status: Accepted

Solution code:
from math import floor


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

if __name__ == "__main__":
    main()

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':
	A,B,N = map(int,input().split())
	ans = 0
	c = 0
	if B > N:
		ans = (A*N)//B - A*(N//B)
	else:
		x = B-1
		ans = (A*x)//B - A*(x//B)

	print(ans)

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)
    X = (a * x) // b
    Y = a * (x // b)
    print(X - Y)
if __name__ == '__main__':
    main()

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())
te = n // b
if b == 1:
    print(0)
else:
    tes = n - (te * b)
    test = te * b - 1
    if  tes > test:
        print(int(a*n/b) - a*int(n/b))
    else:
        print(int(a*test/b) - a*int(test/b))

Submission status: Accepted

Solution code:

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

d = min(n , b-1)
ans = math.floor((a*d)/b) - a * math.floor(d/b)

print(ans)

Submission status: Accepted

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

def main():
    A, B, N = map(int, readline().rstrip().split())
    x = B - 1
    if x > N:
        x = N
    ans = (A * x) // B - A * (x // B)
    print(ans)
    

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math

A, B, N= (int(x) for x in input().split())
#x = B * math.floor(N/B) - 1
x =  B - 1
if N < B:
    x = N
a = math.floor(A * x / B) - A * math.floor(x / B)
# b = math.floor(A * N / B) - A * math.floor(N / B)
print(a)

Submission status: Accepted

Solution code:
import math

def func(x):
    global a,b
    return int(math.floor(a*x/b)-a*math.floor(x/b))

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

a, b, n = map(int, input().split())
x = b - 1
if n < x:
    x = n

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

print(ans)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

a,b,n = [int(x) for x in input().split()]

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

Submission status: Accepted

Solution code:
from math import factorial,sqrt,ceil,gcd,floor
# from itertools import permutations as permus
# from collections import deque,Counter
# import re
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import networkx as nx
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb

# slist = "abcdefghijklmnopqrstuvwxyz"
A,B,N = map(int,input().split())

def yosiki(x):
    return floor(A*x/B)-A*floor(x/B)
if B == 1:
    print(0)
    exit()
elif A == B:
    x = min(N,B-1)
    print(yosiki(x))
    exit()
elif A>B:
    x = min(N,B-1)
    print(yosiki(x))
    exit()
elif A<B:
    x = min(N,B-1)
    print(yosiki(x))
    exit()
# print(ans)
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))

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
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
import itertools
if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
a,b,n=map(int,input().split())
cnt=0

if n//b>0:
	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())
c=max(0,a//b)
d=min(b,n)
def floor(x):
    return int((a*x)/b)-a*(int(x/b))
if n<b:
    print(floor(n))
elif n==b:
    print(floor(b-1))
else:
    if b<a:
        print(floor(b-1))
    elif b==a:
        print(floor(b))
    else:
        e=max(b-1,a//b)
        print(floor(e))

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(n)]
import math
if n <b:
    x=n
    v=a*x
    v=v//b
    #ans=math.floor((x/b)*a)
    ans=v
else:
    ansl=[]
    x=b-1
    v=a*x
    v=v//b-a*(x//b)
    #ans=math.floor((x/b)*a)
    ans=max(v,0)
    v=a*n
    v=v//b-a*(n//b)
    ans=max(ans,v)
    #ansl.append(ans)
print(ans)

Submission status: Accepted

Solution code:
from math import floor
A,B,N = [int(_n) for _n in input().split()]
# if A == 1:
#     print(0)

t = min(N, B-1)
print((t*A//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:
import math
A, B, N=list(map(int, input().split()))
if B > N:
    X = N
else:
    X = B-1

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

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

Submission status: Accepted

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

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

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


ans1 = 0

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

Submission status: Accepted

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

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)
    print(ans)
else:
    ans = a - (a-1) // b - 1
    print(ans)

Submission status: Accepted

Solution code:
import sys
import os

def file_input():
    f = open('../Beginner_Contest_165/input.txt', 'r')
    sys.stdin = f

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

    max=0
    # for x in range(N+1):
    #     # ans=int(A*x/B)-A*int(x/B)
    #     min,_=math.modf(x/B)
    #     # ans=int(A*min)
    #     # print(min)
    #     if x==0:
    #         max=min
    #     elif min > max:
    #         max=min
    #     else:
    #         break

    # max=0
    # max_x=0
    # first=0
    #
    # for x in range(N+1):
    #     rem = x%B
    #     if x == 0:
    #         first=rem
    #     elif rem == first:
    #         break
    #     if rem > max:
    #         max=rem
    #         max_x=x

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

    # min,_=math.modf(max_x/B)

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math

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

a,b,n = readInts()

x = min(b-1,n)

print(x*a//b)

Submission status: Accepted

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

Submission status: Accepted

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


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

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

print(calc(x))

Submission status: Accepted

Solution code:
from math import factorial as fact
import math
import sys
import itertools
import numpy as np
from collections import Counter
import datetime


#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))

def keta(N):
	return len(str(N))


def input_daytime(input_time):
	time,distance=input_time.split()
	t=time.split(":")
	se=str(t[-1]).split(".")
	dt1 = datetime.timedelta(hours=int(t[0]),minutes=int(t[1]),seconds=int(se[0]),milliseconds=int(se[1]))
	return dt1

def combinations(n,r):
	return list(itertools.combinations(range(n),r))



def all_sets(num_list):
	subsets=[]
	for i in range(2,len(num_list) + 1):
		for c in combinations(num_list, i):
			subsets.append(c) 
	return subsets

#公約数の列挙
def ch(x1):
	cf=[]
	for i in range(2,math.sqrt(x1)+1):
		if x1 % i==0:
			cf.append(i)
	return cf

def CountOneRoots(x,y):
	#x:縦，y:横
	return fact(x+y)/fact(x)/fact(y)

# 素因数分解
def factorization(n):
	tmp=n
	count=0
	for i in range(2,int(n**0.5)+2):
		if tmp%i==0:
			cnt=0
			while tmp%i==0:
				cnt+=1
				tmp//=i
			count+=1
	if tmp!=1:
		count+=1

	return count
			

def fl(a,b,x):
	b1=x//b
	x=math.floor(a*x/b)
	y=math.floor(b1)
	return x-y
	


# n,m,q = input2()
# abcd=[]
# A=[0]*n
# for i in range(q):
# 	abcd.append(input_array())

a,b,n=input2()
if b>n:
	b_ans=fl(a,b,n)
	# print(b_ans)
else:
	b_ans=fl(a,b,b-1)

for i in range(0,n,b):
	ans=fl(a,b,i)
	# print(ans)
	if ans> b_ans:
		b_ans=ans
	else:
		break
# if i<n:
# 	ans=fl(a,b,n)
# 	if ans> b_ans:
# 		b_ans=ans
print(b_ans)

Submission status: Accepted

Solution code:
import math

#X=int(input())
# a=int(input())
A,B,N=map(int,input().split(" "))
#a=[int(_) for _ in input().split(" ")]

s=N//B

if s==0:
  x=N
else:
  x=s*B-1

if B==1:
  ans=0
  #print("B")
else:
  ans = int(x/B*A) - A * int(x/B)

print(ans)

Submission status: Accepted

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

for i in range(b+1):
  w=int(a*i/b)-a*int(i/b)
  if m<w or m==-1:
    m=w
print(m)
"""
if b<=n:
  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:
import math
a, b, n = map(int, input().split())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    from sys import stdin
    # from collections import defaultdict
    import math
    input = stdin.readline

    # import random

    a, b, n = map(int, input().split())
    """
    a = random.randint(1, 10**6)
    b  = random.randint(1, 10**6)
    n = random.randint(1, 10**12)
    """
    # print(a, b, n)
    
    if b > n:
        # print('a')
        print(int(math.floor((a*n)/b) - a*math.floor(n/b)))
        exit()
    print(int(math.floor((a*(b-1))/b)))

Submission status: Accepted

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

def solve(A: int, B: int, N: int):
    max_b = 0

    k = min(N,B-1)
    # print(k)
    # for x in range(min(N+1,1000000)):
    max_b = math.floor(A*k/B)
    print(max_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:
#X = int(input())
def maxnumber(N, B):
  if N < B:
    return N
  a = (N // B) * B - 1
  if N == a + B:
    return N
  else:
    return a
  
A, B, N = list(map(int, input().strip().split()))
X = maxnumber(N, B)
ans = (A * X) // B - A * (X // B)
#print(X)
print(ans)

Submission status: Accepted

Solution code:
# import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)


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

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

    print(res)



main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
ABN = [int(a) for a in input().split(" ")]
A = ABN[0]
B = ABN[1]
N = ABN[2]
if N < B:
    x = N
else:
    x = B - 1
f = (A*x)//B - A*(x//B)
print(int(f))

Submission status: Accepted

Solution code:
import math
def fun(A, B, x):
    return math.floor(A*x/B)-A*math.floor(x/B)

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