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: Wrong Answer

Solution code:
import math
a,b,n = map(int,input().split())
maxx = n//b
ans = 0
for i in range(min(maxx,10**7)):
    x = b*(maxx-i)-1
    ans = max(math.floor(a*x/b)-a*(math.floor(x/b)),ans)
ans = max(math.floor(a*n/b)-a*(math.floor(n/b)),ans)
print(ans)

Submission status: Wrong Answer

Solution code:
import math
a,b,n = map(int,input().split())
maxx = n//b
ans = 0
for i in range(min(maxx,10**6)):
    x = b*(maxx-i)-1
    ans = max(math.floor(a*x/b)-a*(math.floor(x/b)),ans)
ans = max(math.floor(a*n/b)-a*(math.floor(n/b)),ans)
print(ans)

Submission status: Wrong Answer

Solution code:
def f(a, b, n):
    if b == 1:
        print(0)
    else:
        count = 0
        Max = 0
        step = 1 if b // a ==  0 else b // a
        for x in range(b // a, n + 1, step):
            res = (a * x) // b - a * (x // b)
            if res > Max:
                #print(x, res)
                Max = res
                count += 1
                #if count > 20:
                #    break
        print(Max)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A, B, N = map(int, input().split())
import math
maximum = 0
minimum = 1000000000
for x in range(N,-1,-1): # xは非負なので0含む？
  val = (A * x // B) - A * (x // B)
#  print(val)
  if minimum < val:
    break
  minimum = min(val, minimum)
  maximum = max(val, maximum)
print(maximum)

Submission status: Wrong Answer

Solution code:
A, B, N = map(int, input().split())
import math
maximum = 0
for x in range(N+1,0,-1): # xは非負なので0含む？
  val = (A * x // B) - A * (x // B)
  if maximum < val:
    break
  maximum = max(val, maximum)
print(maximum)

Submission status: Wrong Answer

Solution code:
A, B, N = map(int, input().split())
import math
maximum = 0
for x in range(N+1,0,-1): # xは非負なので0含む？
  val = (A * x // B) - A * (x // B)
  if maximum > val:
    break
  maximum = max(val, maximum)
print(maximum)

Submission status: Wrong Answer

Solution code:
A, B, N = map(int, input().split())
import math
maximum = 0
memo = []
for x in range(N+1): # xは非負なので0含む？
  val = math.floor(A * x / B) - A * math.floor(x / B)
  if val in memo:
    break
  memo.append(val)
  maximum = max(val, maximum)
print(maximum)

Submission status: Wrong Answer

Solution code:
A,B,N=map(int,input().split())
#print(math.floor(A/B))
#c=[0]*N
s=0

if N<=B:
  print(max((A*(N-1))//B-A*((N-1)//B),(A*N)//B-A*(N//B)))
else:print(A-1)
exit()
for i in range(1,N+1):
  if s<(A*i)//B-A*(i//B):
    s=(A*i)//B-A*(i//B)
  if s==39204:print(i)
print(s)

Submission status: Wrong Answer

Solution code:
A,B,N=map(int,input().split())
#print(math.floor(A/B))
#c=[0]*N
s=0

if N<=B:
  print((A*(N-1))//B-A*((N-1)//B))
else:print(A-1)
exit()
for i in range(1,N+1):
  if s<(A*i)//B-A*(i//B):
    s=(A*i)//B-A*(i//B)
  if s==39204:print(i)
print(s)

Submission status: Wrong Answer

Solution code:
A,B,N=map(int,input().split())
#print(math.floor(A/B))
#c=[0]*N
s=0
if N<B:
  print((A*N)//B-A*(N//B))
else:print(A-1)

exit()
for i in range(1,N+1):
  if s<(A*i)//B-A*(i//B):
    s=(A*i)//B-A*(i//B)

print(s)

Submission status: Wrong Answer

Solution code:
A,B,N=map(int,input().split())
#print(math.floor(A/B))
#c=[0]*N
s=0
if N<B:
  print((A*N)//B-A*(N//B))
else:print(B)

exit()
for i in range(1,N+1):
  if s<(A*i)//B-A*(i//B):
    s=(A*i)//B-A*(i//B)

print(s)

Submission status: Wrong Answer

Solution code:
A,B,N=map(int,input().split())
#print(math.floor(A/B))
#c=[0]*N
s=0
print(max(N,(A*N)//B-A*(N//B)))

exit
for i in range(1,N+1):
  if s<(A*i)//B-A*(i//B):
    s=(A*i)//B-A*(i//B)

print(s)

Submission status: Wrong Answer

Solution code:

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

if n < b:
  print((a*n)//b)
  

else:
  print(0)

Submission status: Wrong Answer

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

print(min(b-1,n))

Submission status: Wrong Answer

Solution code:
import math

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

max_result = -10 ** 12

N = min(N, 10 ** 8)
for x in range(0, N+1):
    tmp = math.floor(A * x / B) - (A * math.floor(x / B))
    max_result = max(max_result, tmp)

print(max_result)

Submission status: Wrong Answer

Solution code:
import math

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

max_result = -10 ** 12

N = min(N, 10 ** 6)
for x in range(0, N+1):
    tmp = math.floor(A * x / B) - (A * math.floor(x / B))
    max_result = max(max_result, tmp)

print(max_result)

Submission status: Wrong Answer

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


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math

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

if n >= 10001:
    for x in range(n-10000, n+1):
        c = math.floor(a * x / b) - (a * math.floor(x / b))
        if c not in list:
            list.append(c)
else:
    for x in range(n+1):
        c = math.floor(a * x / b) - (a * math.floor(x / b))
        if c not in list:
            list.append(c)

print(max(list))

Submission status: Wrong Answer

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

if n >= 10001:
    for x in range(n-10000, n+1):
        c = int(a * x / b) - (a * int(x / b))
        if c not in list:
            list.append(c)
else:
    for x in range(n+1):
        c = int(a * x / b) - (a * int(x / b))
        if c not in list:
            list.append(c)

print(max(list))

Submission status: Wrong Answer

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

if n >= 1001:
    for x in range(n-1000, n+1):
        c = int(a * x / b) - (a * int(x / b))
        if c not in list:
            list.append(c)
else:
    for x in range(n+1):
        c = int(a * x / b) - (a * int(x / b))
        if c not in list:
            list.append(c)

print(max(list))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

x=max(n,b-1)

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

print(ans)

Submission status: Wrong Answer

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



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

print(ans)

Submission status: Wrong Answer

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

ans=[]

for i in range(b):
    
    ans.append(int(a*i/b) - a * int(i/b))

print(max(ans))

Submission status: Wrong Answer

Solution code:
import math

A, B, N = map(int, input().split())
tmp = 0
x = math.floor(N / 2)

if math.floor(A * x / B) - A * math.floor(x / B) < math.floor(
    A * (x + 1) / B
) - A * math.floor((x + 1) / B):
    direction = 1
else:
    direction = -1

while True:
    ans = math.floor(A * x / B) - A * math.floor(x / B)
    if ans < tmp:
        break
    x += direction
print(ans)

Submission status: Wrong Answer

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

ans = 0
for x in range(n+1):
  m = (a*x)//b + a*(x//b)
  ans = max(ans,m)

print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

x = max(b-1, n)

print((a*x)//b)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if n==1 :
    ans=int(a/b)
elif n<b :
    ans=int(a*n/b)-a*int(n/b)
else :
    ans0=int(a*(b-1)/b)-a*int((b-1)/b)
    ans1=int(a*n/b)-a*int(n/b)
    ans=max(ans0,ans1)

print(ans)

Submission status: Wrong Answer

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

if n<b :
    ans=int(a*n/b)-a*int(n/b)
else :
    ans0=int(a*(b-1)/b)-a*int((b-1)/b)
    ans1=int(a*n/b)-a*int(n/b)
    ans=max(ans0,ans1)

print(ans)

Submission status: Wrong Answer

Solution code:
A, B, N = map(int, input().split())
tmp = 0
ans = 0
for num in range(N+1):
  value = int((A*num)/B) - A*int(num/B)
  if value > tmp:
    tmp = value
    ans = num
print(ans)

Submission status: Wrong Answer

Solution code:
A, B, N = map(int, input().split())
tmp = 0
ans = 0
for num in range(N+1):
  value = int(A*num/B) - A*int(num/B)
  if value > tmp:
    tmp = value
    ans = num
print(ans)

Submission status: Wrong Answer

Solution code:
A, B, N = map(int, input().split())
tmp = 0
ans = 0
for num in range(N+1):
  value = int(A*num/B) - A*int(num/B)
  if value > tmp:
    ans = num
print(ans)

Submission status: Wrong Answer

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

ans = 0
for i in range(N // B * B, N + 1):
    ans = max(ans, math.floor(A * i / B) - A * math.floor(i / B))
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math

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

k = n//b

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
import math

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

k = n//b

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

print(ans)

Submission status: Wrong Answer

Solution code:
import math

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

k = n//b

ans = math.floor(a*(k*b-1)/b) - a*(k-1)

print(ans)

Submission status: Wrong Answer

Solution code:
import math


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


def main(A, B, N):
    if N < B:
        return f(A, B, N)
    else:
        return A - 1


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

Submission status: Wrong Answer

Solution code:
'''
Created on 2020/08/29

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
  A,B,N=map(int,pin().split())
  t=int(B/A)
  ans=0
  for x in range(t,B+1):
    ans=max(ans,int(A*x/B)-A*int(x/B))
  print(ans)
  return 
main()

Submission status: Wrong Answer

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


if '__main__' == __name__:
    resolve()

Submission status: Wrong Answer

Solution code:
import math


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

    for x in range(1, 100):
        temp = math.floor(A*x/B) - A * math.floor(x/B)
        if temp < N:
            ans = temp
        else:
            print(ans)
            break


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Q = A // B
R = A % B

if B <= N:
    ans = R - 1 + Q * (B - 1)
else:
    ans = int(A * N / B) - A * int(N / B)

print(ans)

Submission status: Wrong Answer

Solution code:
import math
 
A, B, N = map(int, input().split())
f = []
count = 0
roop = k = True
zero = False
for x in range(N+1):
  count += 1
  s = math.floor(A*x/B) - A * math.floor(x/B)
  f.append(s)
  if s != 0:
      k = False
  if s == 0 and roop == True and k == False:
      roop = False
  elif s == 0 and roop == False:
      zero = True
      print(f[count-2])
      exit()
if zero == False:
    print(f[count-1])

Submission status: Wrong Answer

Solution code:
import math

A, B, N = map(int, input().split())
f = []
count = 0
roop = True
zero = False
for x in range(N+1):
  count += 1
  s = math.floor(A*x/B) - A * math.floor(x/B)
  f.append(s)
  if s == 0 and roop == True and count >= 3:
      roop = False
  elif s == 0 and roop == False:
      zero = True
      print(f[count-2])
      exit()
if zero == False:
    print(f[count-1])

Submission status: Wrong Answer

Solution code:
import math
 
A, B, N = map(int, input().split())
f = []
count = 0
roop = True
zero = False
for x in range(N+1):
  count += 1
  s = math.floor(A*x/B) - A * math.floor(x/B)
  f.append(s)
  if s == 0 and roop == True and count >= N:
      roop = False
  elif s == 0 and roop == False:
      zero = True
      print(f[count-1])
      exit()
if zero == False:
    print(f[count-1])

Submission status: Wrong Answer

Solution code:
import math

A, B, N = map(int, input().split())
f = []
count = 0
roop = True
zero = False
for x in range(N+1):
  count += 1
  s = math.floor(A*x/B) - A * math.floor(x/B)
  f.append(s)
  if s == 0 and roop == True and count >= N:
      roop = False
  elif s == 0 and roop == False:
      zero = True
      print(f)
      print(f[count-1])
      exit()
if zero == False:
    print(f[count-1])

Submission status: Wrong Answer

Solution code:
import math

A = 5
B = 7
N = 4
f = []
count = 0
roop = True
zero = False
for x in range(N+1):
  count += 1
  s = math.floor(A*x/B) - A * math.floor(x/B)
  f.append(s)
  if s == 0 and roop == True and count >= N:
      roop = False
  elif s == 0 and roop == False:
      zero = True
      print(f)
      print(f[count-1])
      exit()
if zero == False:
    print(f[count-1])

Submission status: Wrong Answer

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()
 
 
def main():
    a,b,n=map(int, input().split())
    if b<n:
        n=b-1
    print(((a*n)//b) - (a*(n//b)))
    

    
 
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

x = min(B, N)

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

print(ans)

Submission status: Wrong Answer

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 = 0
if B <= N:
    N = B
for x in range(B//A , min(B-1,N)):
    n = f(A,B,x)
    if n > ans:
        ans = n

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from math import floor

A, B, N = map(int, input().split())
print(max([floor(A * x / B) - A * floor(x / B) for x in range(N % B + 1)]))

Submission status: Wrong Answer

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

# print(max)

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

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

else:
    x=b-1
    ans=int(a*x/b)-int(a*x/b)

print(ans)

Submission status: Wrong Answer

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

if b>=n:
    x=n
    ans=(a*x)//b -a*(x//b)

else:
    x=b-1
    ans=(a*x)//b -a*(x//b)

print(ans)

Submission status: Wrong Answer

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

print(max)

Submission status: Wrong Answer

Solution code:
def floor(bunshi,bunbo):
    return bunshi//bunbo

a,b,n = map(int,input().split())
ans = 0
for i in range(1,b):
    tmp = floor(a*i,b) - a * floor(i,b)
    #print(i,tmp)
    ans = max(ans,tmp)
    
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = -1

if b > n:
    for i in range(n+1):
        calc = (a*i)//b - (a * (i//b))
        ans = max(calc,ans)
else:
    for i in range(b-1,n+1,b):
        calc = (a*i)//b - (a * (i//b))
        print(i,calc,(a*i)//b ,(a * (i//b)))
        ans = max(calc,ans)

print(ans)

Submission status: Wrong Answer

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

c = min(b - 1, n)
#logging.debug(c)

print(((a * c) / b) // 1 - (a * ((c / b) // 1)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b,n=map(int,input().split())
k=n
x=(a*n)//b
y=(n//b)*a
for i in range(n):
    if (a*(k))//b==(a*(k-i))//b:
        x=(a*(k-i))//b
    else:
        break
print(x-y)

Submission status: Wrong Answer

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


sum = 0

for x in range(1, N):
  temp = int((A * x) / B) - A * int(x / B)
  if sum < temp:
    sum = temp
    
print(sum)

Submission status: Wrong Answer

Solution code:
import math

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

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

term1 = math.floor(a * x / b)
term2 = a * math.floor(x / b)

print(term1 - term2)

Submission status: Wrong Answer

Solution code:
import math

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

term1 = math.floor(a * n / b)
term2 = a * math.floor(n / b)

print(term1 - term2)

Submission status: Wrong Answer

Solution code:
maxa=-(10**10)
a,b,n=map(int,input().split())
if n<=1000000:
  for i in range(1,n+1):
    maxa=max(((a*i)//b)-a*(i//b),maxa)
  print(maxa)
else:
  for i in range(n-1000000,n+1):
    maxa=max(((a*i)//b)-a*(i//b),maxa)
  for i in range(1,11):
    maxa=max(((a*i)//b)-a*(i//b),maxa)
  print(maxa)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print((a*x)//b)

Submission status: Wrong Answer

Solution code:
import math

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

Submission status: Wrong Answer

Solution code:
import math

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math

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

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

Submission status: Wrong Answer

Solution code:
import math
A,B,N=map(int,input().split())
han=0
kot=0
i=0
if B-1>=N:
    print(math.floor(A*N/B)-A*math.floor(N/B))
    i=1
else:
    for a in range(B-1,N-5,B):
        if han<(math.floor(A*a/B)-A*math.floor(a/B)):
            han=(math.floor(A*a/B)-A*math.floor(a/B))
            kot=a

if i==0:
    print(han)

Submission status: Wrong Answer

Solution code:
from math import floor
from decimal import Decimal

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

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
a,b,n = map(int,input().split())
ans = -1
for i in range(1,n+1)[::-1]:
    x = i
    z = math.floor(a*x/b)-a*math.floor(x/b)
    if z > ans:
        ans = z
    else:
        break
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

print(min(B-1, N))

Submission status: Wrong Answer

Solution code:
a,b,n = list(map(int, input().split()))
t = 0
for i in range(n):
  B = (i//b)
  if B > 0 and t == 0:
    t = B
  elif B > t and t != 0:
    n = B -1
    break

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

Submission status: Wrong Answer

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

for i in range(n):
  B = (i//b)
  if B != 0:
    n = B -1
    break

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

Submission status: Wrong Answer

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

for i in range(n):
  B = (i//b)
  if B != 0:
    n = i-1
    break

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

Submission status: Wrong Answer

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

for i in range(n):
  B = a * (i//b)
  if B != 0:
    n = i-1
    break

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

Submission status: Wrong Answer

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

for i in range(n):
  if i//b > 0:
    n = i-1
    break
ans = 0
for i in range(n):
  A = (a*i)//b
  ans = max(ans,A)

print(ans)

Submission status: Wrong Answer

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

for i in range(n):
  if i//b > 0:
    n = i
    break
ans = 0
for i in range(n):
  A = (a*i)//b
  ans = max(ans,A)

print(ans)

Submission status: Wrong Answer

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

x = np.array([x for x in range(1,n+1)])
A = (a*x)//b
A = np.sort(A)[::-1]
B = a * (x//b)
B = np.sort(B)

print(A[0]-B[0])

Submission status: Wrong Answer

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

T = 0
for i in range(1,n+1)[::-1]:
  t = (a*i)//b - a*(i//b)
  if T < t:exit(print(t))

Submission status: Wrong Answer

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

ans = 0
T = 0
for i in range(1,n+1)[::-1]:
  t = (a*i)//b - a*(i//b)
  if T < t:
    T = t
    ans = i

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A, B, N = map(int, input().split())
x = N
for i in range(N-1,0,-1):
    if int(A*i/B) != int(A*N/B):
        break
    x = i

x2 = 0
for i in range(N):
    if int(i/B) != 0:
        break
    x2 = i

C = int(A*x/B) - A * int(x/B)
D = int(A*x2/B) - A * int(x2/B)

print(max(C,D))

Submission status: Wrong Answer

Solution code:
A, B, N = map(int, input().split())
x = N
for i in range(N-1,0,-1):
    if int(A*i/B) != int(A*N/B):
        break
    x = i

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

Submission status: Wrong Answer

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

print(int(a * n / b))

Submission status: Wrong Answer

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


for i in range(N,-1,-B):
    if (N+1)//B-1 == i//B:
        ans_i = i
        break

if N//B == 0:
    ans_i = N

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from math import floor

A, B, N = map(int, input().split())
x = max(N, B-1)
print(floor(A*x/B)-A*floor(x/B))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b,n = map(int,input().split())
n = 0
for x in range(1000):
    c = int(a*x/b)
    d = int(x/b)
    if c - a*d >= n:
        n = c-d
print(n)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

def main():

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

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

    num = n//b

    ans = (a*num)//b - a * (num//b)
    print(max(ans,(a*n)//b - a * (n//b)))

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
A, B, N = map(int,input().split())
n = 0
x = 1
if N < 10**5:
    while (n+1)*B-1 < N:
        n += 1
else:
    n = int((N+1)/B - 10**5)
    while (n+1)*B-1 < N:
        n += 1

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

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

Submission status: Wrong Answer

Solution code:
A, B, N = map(int,input().split())
n = 0
x = 1
if N < 10**5:
    while (n+1)*B-1 < N:
        n += 1
else:
    n = int((N+1)/B - 10**5)
    while (n+1)*B-1 < N:
        n += 1

print(n)
if n == 0:
    x = N
else:
    x = n*B-1

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

Submission status: Wrong Answer

Solution code:
A, B, N = map(int,input().split())
n = 0
x = 1
if N < 10**5:
    while (n+1)*B-1 < N:
        n += 1
else:
    n = (N+1)/B - 10
    while (n+1)*B-1 < N:
        n += 1

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

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

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
from math import floor

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

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

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
from math import floor

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

print(floor(A/B*N))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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