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:
a,b,n = list(map(int, input().split()))
fnc = lambda x: int(a*x/b) - a*int(x/b)
prev = 0
for i in range(n+1):
    now = fnc(i)
    if prev > now or i == n:
        print(prev)
        break
    prev = now

Submission status: Wrong Answer

Solution code:
import math
A,B,N=map(int, input().split())
NUM=0
if A>B:
    for x in range(N+1,math.floor(N/2),-1):
        TGT=math.floor(A*x/B)-A*math.floor(x/B)
        if TGT>NUM:
            NUM=TGT
else:
    for x in range(math.floor(N/2),N+1):
        TGT=math.floor(A*x/B)-A*math.floor(x/B)
        if TGT>NUM:
            NUM=TGT
print(NUM)

Submission status: Wrong Answer

Solution code:
import time

def floor(y):
    return int(y)

def main():
    t1 = time.time()

    a, b, n = map(int, input().split())
    ans = [floor(a*x/b) - a*floor(x/b) for x in range(1, n+1)]
    print(max(ans))

    t2 = time.time()

    print(f"経過時間：{t2-t1}")

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import math

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

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

Submission status: Wrong Answer

Solution code:
a,b,n=map(int,input().split())
if b>=n:
	l=a*n//b
elif b<n:
  l=-10**30
  for i in (b,n):
    d=a*i//b-a*(i//b)
    if d>l:
      l=d
print(l)

Submission status: Wrong Answer

Solution code:
a,b,n=map(int,input().split())
if b>=n:
	l=a*n//b
elif b<n:
  l=-10000
  for i in (b,n):
    d=a*i//b-a*(i//b)
    if d>l:
      l=d
print(l)

Submission status: Wrong Answer

Solution code:
a,b,n=map(int,input().split())
l=a*n//b
if b<n:
  for i in (b,n):
    d=a*i//b-a*(i//b)
    if d>l:
      l=d
print(l)

Submission status: Wrong Answer

Solution code:
a,b,n=map(int,input().split())
l=a*n//b
if b<n:
  for i in (b,n):
    d=a*i//b-a*(i//b)
    print(i)
    if d>l:
      l=d
print(l)

Submission status: Wrong Answer

Solution code:
a,b,n=map(int,input().split())
l=a*n//b
if b>n:
  for i in (n,b):
    d=a*i//b-a*(i//b)
    if d>l:
      l=d
print(l)

Submission status: Wrong Answer

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


def solve(A: int, B: int, N: int):
    # max[A * x // B - A *(x // B)]
    # x <= N
    # x = pB + r -> Ar // B
    r = B-1 if B < N else N
    ans = (r * A) // B
    print(ans)
    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: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math 
 
a,b,n = map(int,input().split())
 
if b > n:
    ans = math.floor(a*n/b) - a*math.floor(n/b)
    print(int(ans))
    exit()
elif b%n == 0:
    n -= 1
    ans = math.floor(a*n/b) - a*math.floor(n/b)
else:
    c = (n//b) -1
    c = math.floor(n/b)*b-1
    temp = math.floor(a*c/b) - a*math.floor(c/b)#一番大きい倍数の前
    print(temp)

Submission status: Wrong Answer

Solution code:
import math 
 
a,b,n = map(int,input().split())
 
if b > n:
    ans = math.floor(a*n/b) - a*math.floor(n/b)
    print(int(ans))
    exit()
 
c = math.floor(n/b)*b-1
temp = math.floor(a*c/b) - a*math.floor(c/b)#一番大きい倍数の前
print(temp)

Submission status: Wrong Answer

Solution code:
from math import floor
a,b,n = map(int, input().split())
x = n
com = 0
val = (a*x)//b-a*(x//b)
if val < com:
    pass
else:
    com = val
print(com)

Submission status: Wrong Answer

Solution code:
import math
A, B, N = list(map(int, input().split()))
ans = 0
if B+1 < N:
    C = B+1
else:
    C = N
if B//A == 0:
    D = 1
else:
    D = B//A
for i in range(1, C+1, D):
    val = math.floor(A*i/B) - A*math.floor(i/B)
    #print("i", i, "val", val)
    ans = max(ans, val)

print(ans)

Submission status: Wrong Answer

Solution code:
from math import floor
a,b,n = map(int, input().split())
x = n
com = 0
while x >= 0:
    val = floor((a*x)/b)-a*floor(x/b)
    if val < com:
        pass
    else:
        com = val
    x-=1
    print("val = ",val,"   com = ",com)
print(com)

Submission status: Wrong Answer

Solution code:
import math

a, b, n = map(int, input().split())
if n < b:
    print((a*n)//b)
else:
    ans = -1
    for x in range(b+1):
        tmp = math.floor((a*x)/b) - math.floor(a*(x/b))
        if tmp > ans:
            ans = tmp
        elif tmp < ans:
            break
    print(ans)

Submission status: Wrong Answer

Solution code:
A, B, N = map(int, input().split())
ans = 0
for x in range(1, B):
    now = (A*(x%B) - (A*x)%B)/B
    ans = max(now, ans)
print(int(ans))

Submission status: Wrong Answer

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

ans = 0
for i in range(10 ** 8):
  ans = max(ans, A * i // B - A * (i // B))

for i in range(10 ** 8):
  i = N - i
  if i < 0:
    break
  ans = max(ans, A * i // B - A * (i // B))

print(ans)

Submission status: Wrong Answer

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

ans = 0
for i in range(10 ** 7):
  ans = max(ans, A * i // B - A * (i // B))

for i in range(10 ** 7):
  i = N - i
  if i < 0:
    break
  ans = max(ans, A * i // B - A * (i // B))

print(ans)

Submission status: Wrong Answer

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

ans = 0
for i in range(10 ** 7):
  ans = max(ans, A * i // B - A * (i // B))

print(ans)

Submission status: Wrong Answer

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

ans = 0
for i in range(10 ** 6):
  ans = max(ans, A * i // B - A * (i // B))

for i in range(10 ** 6):
  i = N - i
  if i < 0:
    break
  ans = max(ans, A * i // B - A * (i // B))

print(ans)

Submission status: Wrong Answer

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

ans = 0
for i in range(10 ** 6):
  print(A * i // B - A * (i // B))
  ans = max(ans, A * i // B - A * (i // B))

for i in range(10 ** 6):
  i = N - i
  if i < 0:
    break
  ans = max(ans, A * i // B - A * (i // B))

print(ans)

Submission status: Wrong Answer

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

ans = 0
for i in range(10 ** 5):
  ans = max(ans, A * i // B - A * (i // B))

for i in range(10 ** 5):
  i = N - i
  if i < 0:
    break
  ans = max(ans, A * i // B - A * (i // B))

print(ans)

Submission status: Wrong Answer

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

ans = 0
for i in range(10 ** 5):
  ans = max(ans, A * i // B - A * (i // B))

for i in range(10 ** 5):
  i = N - i
  ans = max(ans, A * i // B - A * (i // B))

print(ans)

Submission status: Wrong Answer

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

ans = 0
for i in range(10 ** 5):
  ans = max(ans, A * i // B - A * (i // B))

print(ans)

Submission status: Wrong Answer

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

ans = 0
for i in range(10 ** 5):
  print(A * i // B - A * (i // B))
  ans = max(ans, A * i // B - A * (i // B))

print(ans)

Submission status: Wrong Answer

Solution code:
import math
import time

A,B,N = map(int,input().split())
max_n = -1
st = time.time()
for i in range(N+1) :
    # n = math.floor((A * i)/B) - A * math.floor(i/B)
    # n = ((A * i) // B) - A * (i // B)
    n = ((A * i) // B) - A * (i // B)
    # print(i,n)
    if (max_n < n) :
        max_n = n
    
    if (time.time() - st > 1.9) :
        break

print(max_n)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
A,B,N=map(int,input().split())
a,b,x=0,0.1,1
while b>a:
    a=math.floor(A*x/B)-A*math.floor(x/B)
    b=math.floor(A*(x+1)/B)-A*math.floor((x+1)/B)
    x+=1
print(a)

Submission status: Wrong Answer

Solution code:
import math
A, B, N = map(int, input().split())
max = 0
for i in range(N):
  i += 1
  num = math.floor(A * i / B) - A  * math.floor(i / B)
  if max < num:
    max = num
print(num)

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
def solve():
    # a=102
    # b=829
    # for i in range(100000):
    #     print(((a*i)//b)-(a*(i//b)))
    a,b,n=map(int,input().split())
    x=min(a,b)-1
    if(n>max(a,b)):
        print(x)
    else:
        val=0
        for i in range(n+1):
            val=((a*i)//b)-(a*(i//b))
        print(val)
solve()

Submission status: Wrong Answer

Solution code:
def solve():
    a,b,n=map(int,input().split())
    x=min(a,b)-1
    if(n>x):
        print(x)
    else:
        val=0
        for i in range(n+1):
            val=((a*i)//b)-(a*(i//b))
        print(val)
    
solve()

Submission status: Wrong Answer

Solution code:
import math

A, B, N = (int(x) for x in input().split())
ans = min(A, math.floor(A * N / B))
print(ans)

Submission status: Wrong Answer

Solution code:
import math
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())

ans =0

# for x in range(1,n+1):
ans = max( ans , (a * (n+1)) // b - a* ((n+1) // b))
print(ans)

Submission status: Wrong Answer

Solution code:
import math
from collections import defaultdict
ml=lambda:map(int,input().split())
ll=lambda:list(map(int,input().split()))
ii=lambda:int(input())
ip=lambda:(input())

"""========main code==============="""

a,b,c=ml()
d=(a*c)%b
x=d//a
print(((a*(c-x))//b)-a*((c-x)//b))

Submission status: Wrong Answer

Solution code:
from sys import setrecursionlimit, exit
setrecursionlimit(1000000000)

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

main()

Submission status: Wrong Answer

Solution code:
import sys
import math
a,b,n = map(int, input().split())
num = 0
for i in range(1,n+1):
    z = ((a*i - a*i%b) - a*(i-i%b))/b
    if z > num and z <= n:
        num = z
print(int(num))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
import math
a,b,n = map(int, input().split())
num = - sys.maxsize
for i in range(1,n+1):
    z = math.floor(a*i/b) - a*math.floor(i/b)
    if z > num and z <= n:
        num = z
print(num)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans_list = []

for q in range(n + 1):
  ans_list.append(int(a * q / b))
print(max(ans_list))

Submission status: Wrong Answer

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

from math import gcd, floor

g = A * B // gcd(A, B)
N = N % g

if N < B:
    n = N
else:
    n = N // B * B - 1

result = floor(A * n / B) - A * floor(n / B)

print(result)

Submission status: Wrong Answer

Solution code:
import sys
a, b, n, = map(int, input().split())
if n < b:
    print(int(a*(n)/b)-a*int((n)/b))
    sys.exit(0)
max = 0
if b == 0:
    print(0)
    sys.exit(0)
row, up = n-b, n
while row <= up:
    mid = (row+up)//2
    if n//b == mid//b:
        up = mid-1
    elif n//b > mid//b:
        row = mid+1
if int((a*up)/b)-a*int((up)/b) > int((a*n)/b)-a*int((n)/b):
    print(int((a*up)/b)-a*int((up)/b))
else:
    print(int((a*n)/b)-a*int((n)/b))

Submission status: Wrong Answer

Solution code:
def floor(x):
  return int(x)
a,b,n = map(int,input().split())
m = ((n//b))*b-1
m = max(0,m)
print(max(floor(a*m/b)-a*floor(m/b),floor(a*n/b)-a*floor(n/b)))

Submission status: Wrong Answer

Solution code:
import sys
a, b, n, = map(int, input().split())
if n < b:
    print(int(a*(n)/b)-a*int((n)/b))
    sys.exit(0)
max = 0

row, up = n-b, n
while row <= up:
    mid = (row+up)//2
    if n//b == mid//b:
        up = mid-1
    elif n//b > mid//b:
        row = mid+1
if int((a*up)/b)-a*int((up)/b) > int((a*n)/b)-a*int((n)/b):
    print(int((a*up)/b)-a*int((up)/b))
else:
    print(int((a*n)/b)-a*int((n)/b))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
a, b, n = map(int, input().split())
if n < b:
    print(int(a*(n)/b)-a*int((n)/b))
    sys.exit(0)
max = 0

row, up = n-b, n
while row <= up:
    mid = (row+up)//2
    if n//b == mid//b:
        up = mid-1
    elif n//b > mid//b:
        row = mid+1
if int(a*(up)/b)-a*int((up)/b) > int(a*(n)/b)-a*int((n)/b):
    print(int(a*(up)/b)-a*int((up)/b))
else:
    print(int(a*(n)/b)-a*int((n)/b))

Submission status: Wrong Answer

Solution code:
import sys
a, b, n = map(int, input().split())
if n < b:
    print(int(a*(n)/b)-a*int((n)/b))
    # sys.exit(0)
max = 0

row, up = n-b, n
while row <= up:
    mid = (row+up)//2
    if n//b == mid//b:
        up = mid-1
    elif n//b > mid//b:
        row = mid+1
if int(a*(up)/b)-a*int((up)/b) > int(a*(n)/b)-a*int((n)/b):
    print(int(a*(up)/b)-a*int((up)/b))
else:
    print(int(a*(n)/b)-a*int((n)/b))
print()
for i in range(n):
    print(int(a*(i+1)/b)-a*int((i+1)/b))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b,n = map(int, input().split())
s = 1
x = 1
while x <= n:
    s = max(s, a*x//b - a*(x//b))
    x+=1
print(s)

Submission status: Wrong Answer

Solution code:
import math
import sys

a, b , n = map(int, input().split())
ans = []
i = 1
while i <= n:
    ans.append(math.floor(a*i) - a*math.floor(i))
    if (2 <= i) and (ans[i -1] < ans[i-2]):
        break
    i += 1
print(max(ans))

Submission status: Wrong Answer

Solution code:
temp=list(map(int,input().rstrip().split()))
a=temp[0]
b=temp[1]
n=temp[2]
result=((a*n)//b)-(a*(n//b))
print(result)

Submission status: Wrong Answer

Solution code:
N = [int(e) for e in input().split()]
t = N[1] - 1
if(t > N[2]):
    t = N[2]
ans = (N[0]*N[2])//N[1] - N[0]*(t//N[1])
print(ans)

Submission status: Wrong Answer

Solution code:
N = [int(e) for e in input().split()]
t = N[1] - 1
ans = (N[0]*N[2])//N[1] - N[0]*(t//N[1])
print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
def main():
    A, B, N = map(int, input().split())
    max_value = 0
    if N < B:
        np.floor(A*N/B)
    else:
        for x in range(N+1):
            value = np.floor(A*x/B) - A * np.floor(x/B)
            #print(x, value)
            if value > max_value:
                max_value = value
    print(int(max_value))
    
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import numpy as np
def main():
    A, B, N = map(int, input().split())
    max_value = 0
    if N < B:
        np.floor(A*(N-1)/B)
    else:
        for x in range(N+1):
            value = np.floor(A*x/B) - A * np.floor(x/B)
            #print(x, value)
            if value > max_value:
                max_value = value
    print(int(max_value))
    
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import numpy as np
def main():
    A, B, N = map(int, input().split())
    max_value = 0
    if N < B:
        np.floor(A*(B-1)/B)
    else:
        for x in range(N+1):
            value = np.floor(A*x/B) - A * np.floor(x/B)
            #print(x, value)
            if value > max_value:
                max_value = value
    print(int(max_value))
    
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import numpy as np
def main():
    A, B, N = map(int, input().split())
    max_value = 0
    if N > B:
        np.floor(A*(B-1)/B)
    else:
        for x in range(N+1):
            value = np.floor(A*x/B) - A * np.floor(x/B)
            #print(x, value)
            if value > max_value:
                max_value = value
    print(int(max_value))
    
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
hairi=input().split()
a=int(hairi[0])
b=int(hairi[1])
n=int(hairi[2])
i=1
while n>i:
  if i==1:
    if math.floor(a*i/b)-a*math.floor(i/b)<math.floor(a*0/b)-a*math.floor(0/b):
      break
  elif math.floor(a*i/b)-a*math.floor(i/b)<math.floor(a*(i-1)/b)-a*math.floor((i-1)/b):
    break
  i+=1
print(math.floor(a*(i-1)/b)-a*math.floor((i-1)/b))

Submission status: Wrong Answer

Solution code:
import math
hairi=input().split()
a=int(hairi[0])
b=int(hairi[1])
n=int(hairi[2])
i=1
while n>i:
  if i==1:
    if math.floor(a*i/b)-a*math.floor(i/b)<math.floor(a*0/b)-a*math.floor(0/b):
      break
  elif math.floor(a*i/b)-a*math.floor(i/b)<math.floor(a*(i-1)/b)-a*math.floor((i-1)/b):
    break
  i+=1
print(i-1)
print(math.floor(a*(i-1)/b)-a*math.floor((i-1)/b))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

ans_list = []

i = n
for _ in range(10):
  #print(int((a * i) / b), a * int(i / b), int((a * i) / b) - a * int(i / b))
  ans = int((a * i) / b) - a * int(i / b)
  ans_list.append(ans)
  i -= 1
print(max(ans_list))

Submission status: Wrong Answer

Solution code:
a, b, n = map(int, input().split())
max_v = 0
c = 0
for x in range(1, n+1):
  v = int(a*x/b)- a * int(x/b)
  c += 1
  if v > max_v:
    max_v = v
    c = 0
  if c > 10000000:
    break
print(v)

Submission status: Wrong Answer

Solution code:
a, b, n = map(int, input().split())
max_v = 0
c = 0
for x in range(1, n+1):
  v = int(a*x/b)- a * int(x/b)
  c += 1
  if v > max_v:
    max_v = v
    c = 0
  if c > 500000:
    break
print(v)

Submission status: Wrong Answer

Solution code:
a, b, n = map(int, input().split())
max_v = 0
c = 0
for x in range(1, n+1):
  v = int(a*x/b)- a * int(x/b)
  c += 1
  if v > max_v:
    max_v = v
  if c > 1000000:
    break
print(v)

Submission status: Wrong Answer

Solution code:
a, b, n = map(int, input().split())
max_v = 0
c = 0
for x in range(1, n+1):
  v = int(a*x/b)- a * int(x/b)
  c += 1
  if v > max_v:
    max_v = v
  if c > 100000:
    break
print(v)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a, b, n = map(int, input().split())
max_v = 0
for x in range(1, n+1):
  v = int(a*x/b)- a * int(x/b)
  if v > max_v:
    max_v = v
print(v)

Submission status: Wrong Answer

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

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

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

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

Submission status: Wrong Answer

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

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

for i in range(0,B+1):
    Get.append(floor(i))
print(max(Get))

Submission status: Wrong Answer

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


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

result = -1000000000
for i in range(0,N+1):
    print(floor(i))
    if floor(i) > result:
        result = floor(i)
        
print(result)

Submission status: Wrong Answer

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




print(ans)

Submission status: Wrong Answer

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


#判定ロジック
max = 0
for i in range(n+1):
    score = math.floor(a*i/b) - a*math.floor(i/b)
    if score > max:
        max = score

print(score)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

def g(t):
    return int(A*t/B)-A*int(t/B)

if B<=N:
    x=[i for i in range(0,B+1,1)]
    
    y=[g(i) for i in x]
    
    print(y)
    
else:
    print(g(B-1))

Submission status: Wrong Answer

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

def g(t):
    return int(A*t/B)-A*int(t/B)

if B<=N:
    x=[i for i in range(0,B+1,1)]
    
    y=[g(i) for i in x]
    
    print(y)
    
else:
    print(g(N))

Submission status: Wrong Answer

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()
    ret = 0
    mi = math.floor(B / N) + math.floor(A / N)
    for n in range(0, min(B,N)):
        ret = max(ret, f(A, B, n))
    print(ret)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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()
    ret = 0
    mi = math.floor(B / N) + math.floor(A / N)
    for n in range(0, B):
        ret = max(ret, f(A, B, n))
    print(ret)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

if b > n:
    print(math.floor(a*n / b))
elif n%b == 0:
    n -= 1
    print(math.floor(a*n / b) - a * math.floor(n / b))
elif int(n/b) > 1:
    n = n - n%b - 1
    print(math.floor(a*n / b) - a * math.floor(n / b))
else:
    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(A*(N%B)//B)

Submission status: Wrong Answer

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

def g(t):
    return int(A*t/B)-A*int(t/B)

x=[i for i in range(0,N,1)]

y=[g(i) for i in x]

print(max(y))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A,B,N=map(int, input().split())
ans=0
for i in range(N%B+1):
    ans = max(ans, A*i//B - A*(i//B))
print(ans)

Submission status: Wrong Answer

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

print((A * (N % B)) // B)

Submission status: Wrong Answer

Solution code:
A,B,N =map(int,input().split())
ans = 0
if A > B:
    for i in range(1,N+1):
        tmp = (i*A)//B - A*(i//B)
        if ans == tmp and tmp!=0:
            break
        elif ans <tmp:
            ans=tmp
else:
    for i in range(N,2,-1):
        tmp = (i*A)//B - A*(i//B)
        if ans == tmp and tmp!=0:
            break
        elif ans <tmp:
            ans=tmp
print(ans)

Submission status: Wrong Answer

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

print (min(s,B-1))

Submission status: Wrong Answer

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(min(calc(B - 1), calc(N)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Solution code:
A,B,N =map(int,input().split())
ans = 0
for i in range(N):
    tmp = (N*A)//B - A*(N//B)
    if ans <=tmp:
        ans=tmp
print(ans)

Submission status: Wrong Answer

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


if __name__ == '__main__':
    A, B, N = map(int, input().split())
    ans = -float('inf')
    for i in range(1, N + 1):
        val1 = int(floor(A * i / B) - A * floor(i / B))
        ans = max(ans, int(val1))

        if i == 1:
            ini_val = val1
        else:
            if ini_val == val1:
                break

    print(ans)

Submission status: Wrong Answer

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


if __name__ == '__main__':
    A, B, N = map(int, input().split())
    ans = 0
    for i in range(min(A + 1, N + 1)):
        val1 = floor(A * i / B) - A * floor(i / B)
        ans = max(ans, int(val1))

    print(ans)

Submission status: Wrong Answer

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

def g(t):
    return int(A*t/B)-A*int(t/B)

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

else:
    print(int(g(N)))

Submission status: Wrong Answer

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

def g(t):
    return int(A*t/B)-A*int(t/B)

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

else:
    print(int(g(N)))

Submission status: Wrong Answer

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

def g(t):
    return int(A*t/B)-A*int(t/B)

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

else:
    print(g(N))

Submission status: Wrong Answer

Solution code:
import math


def floor(num):
    return num // 1


if __name__ == '__main__':
    A, B, N = map(int, input().split())

    ans = 0
    cnt = 1

    while cnt <= N:
        val1 = floor(A * cnt / B) - A * floor(cnt / B)
        ans = max(ans, int(val1))

        if cnt == 1:
            _, ini_f = math.modf(val1)
        else:
            _, val1_f = math.modf(val1)
            if abs(ini_f - val1_f) <= 10 ** -5:
                break

        # print(cnt, ini_f, )
        cnt += 1

    print(ans)

Submission status: Wrong Answer

Solution code:
import math


def floor(num):
    return num // 1


if __name__ == '__main__':
    A, B, N = map(int, input().split())

    ans = 0
    cnt = 1

    while cnt <= N:
        val1 = floor(A * cnt / B) - A * floor(cnt / B)
        ans = max(ans, int(val1))

        if cnt == 1:
            _, ini_f = math.modf(val1)
        else:
            _, val1_f = math.modf(val1)
            if ini_f == val1_f:
                break

        # print(cnt, ini_f, )
        cnt += 1

    print(ans)

Submission status: Wrong Answer

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