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())
ans=0
t=min(B+1,N+1)

for x in range(t-2,t):
    a=int(A*x/B)
    b=A * int(x/B)
    ans=max(ans,a-b)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# D - Floor Function

from math import floor

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

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

# mx = -1 * float('inf')
# i = 0

# for i in range(N + 1):
#     result = floor(A * i / B) - A * floor(i / B)
#     print(i, result)
#     if mx <= result:
#         mx = result

print(mx)

Submission status: Accepted

Solution code:
import math


def task(a, b, n):
    x = min(b - 1, n)
    print(math.floor(a * x / b) - a * math.floor(x / b))


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

Submission status: Accepted

Solution code:
import math
a, b, n = list(map(int,input().split()))
if b > n:
    print(math.floor(a*n/b))
elif n < 2*b - 1:
    print(max(math.floor(a*n/b)-a,math.floor(a*(b-1)/b)))
else:
    print(a+math.floor((-1)*a/b))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

inputLine=input()
A=int(inputLine.split(" ")[0])
B=int(inputLine.split(" ")[1])
N=int(inputLine.split(" ")[2])

x = min(B-1 , N)

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

print(result)

Submission status: Accepted

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

m = 0
num = math.ceil(b/a)
for i in range(1, b+1, num):
    if n < i:
        break
    a_part = int(a * i / b)
    b_part = a * int(i/b)

    result = a_part - b_part
    if m <= result:
        m = result
    else:
        break

print(m)

Submission status: Accepted

Solution code:
A, B, N = map(int,input().split())
mmax=0
N_max = N if B > N else B
for n in reversed(range(N_max - A, N_max + 1)):
    _max = int(A*n/B)-(A*int(n/B))
    if mmax < _max:
        mmax=_max

print(mmax)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math


nums = [int(e) for e in input().split()]

a = nums[0]
b = nums[1]
n = nums[2]

max_score = -1
score = -1

# for x in range(1, n+1):
#     score = math.floor(a*x/b) - a* math.floor(x/b)
#     if max_score < score:
#         max_score = score
#     elif x > b:
#         break

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

print(max_score)

Submission status: Accepted

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

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

Submission status: Accepted

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

if N < B:
    ans = ((A*N)//B) - A*(N//B)
elif B <= N < 2*B:
    ans = max((((A*N)//B) - A*(N//B)), (((A*(B-1))//B) - A*((B-1)//B)))
elif 2*B <= N:
    ans = max((((A*(B-1))//B) - A*((B-1)//B)), (((A*(2*B-1))//B) - A*((2*B-1)//B)), (((A*(3*B-1))//B) - A*((3*B-1)//B)))

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

a,b,x=MAP()

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

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

Submission status: Accepted

Solution code:
# abc165

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

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

Submission status: Accepted

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

import math

def main():
    a,b,n = 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) - a*math.floor((b-1)/b))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
from sys import setrecursionlimit
from collections import Counter, deque, defaultdict
from math import floor
from bisect import bisect_left
setrecursionlimit(1000000)

INF = int(1e10)
MOD = int(1e9 + 7)

def input():
    return stdin.readline()[:-1]

def main():
    from builtins import int, map
    A, B, N = map(int, input().split())
    m = min(B - 1, N)
    ans = floor(A * m / B) - A * floor(m / B)
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from math import floor

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print((a*x)//b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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


if N>=B-1:
    x=B-1
    ans=math.floor(x*A/B)-math.floor(x/B)
    print(ans)
elif N<B-1:
    x=N
    ans=math.floor(x*A/B)-math.floor(x/B)
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


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


if B == 1 or A == 1:
    print(0)
else:
    print(f(B-1) if N >= B else f(N))

Submission status: Accepted

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

ans = 0
if(B > N):
    ans = math.floor(A * N / B) - A * math.floor(N / B)

else:
    ans = math.floor(A * (B-1) / B) - A * math.floor((B-1)/B)

print(ans)

Submission status: Accepted

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

res = 0
if N < B:
    res = (A * N) // B
else:
    left = B - 1
    right = 10 ** 15
    while right - left > 1:
        mid = (right + left) // 2
        a = ((A * mid) // B) - (A * (mid // B))
        if res > a:
            right = mid
        else:
            res = a
            left = mid

print(res)

Submission status: Accepted

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

if p%B == 0:
    print(int(A*(p-1)//B))
else :
    print(int(A*(p)//B))

Submission status: Accepted

Solution code:


a, b, n = [0] * 3

def format_input(filename = None):
	global a, b, n
	if filename == None:
		a, b, n = list(map(int, input().split()))

	elif filename == '__random__':
		from random import randint as rng
		a = rng(1, 10**6)
		b = rng(1, 10**12)
		n = rng(1, 10**12)
		print(a, b, n)

def get_answer():
	answer = (a * min(b-1, n)) // b
	return answer

if __name__ == '__main__':
	format_input()

	ans = get_answer()
	print(ans)

Submission status: Accepted

Solution code:
from math import floor

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

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

answer = floor(A * x / B) - A * floor(x / B)

print(answer)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

def main():
    A, B, N = map(int, input().split(" "))
    max_score = -float("inf")

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import math

arr = input().split(" ")

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

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

print(a * x // b)

Submission status: Accepted

Solution code:
from math import floor

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

x = None
if N < B:
    x = N
else:
    x = B
    x = B - 1
    # max_diff = 0
    # for _x in range(B, N + 1):
    #     diff = (x / B) - floor(x / B)
    #     if max_diff <= diff:
    #         max_diff = diff
    #         x = _x

answer = floor(A * x / B) - A * floor(x / B)

print(answer)

Submission status: Accepted

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

if(B <= N):
  M = B - 1
else:
  M = N

print((A * M)//B)

Submission status: Accepted

Solution code:
from math import floor


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


def main():
    a, b, n = map(int, input().split())
    if n < min(a, b):
        print(f(n, a, b))
    elif min(a, b) <= n < max(a, b):
        print(max(f(min(a, b) - 1, a, b), f(n, a, b)))
    else:
        print(max(f(max(a, b) - 1, a, b), f(min(a, b) - 1, a, b)))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

def naive(a, b, n):
	ans = 0
	for i in range(1, n + 1):
		ans = max(ans, val(a, b, i))
	return ans

def main(a, b, n):
		return max(val(a, b, n), val(a, b, max((n // b) * b - 1, 1)), val(a, b, max(n - 1, 0)))

# n = 10
# for a in range(1, 1000):
# 	for b in range(1, 1000):
# 		if naive(a, b, n) != main(a, b, n):
# 			print(a, b, naive(a, b, n), main(a, b, n))

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

Submission status: Accepted

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

l = 0
r = N
ans = 0


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


for i in range(10000):

    if r - l < 10:
        for x in range(max(0, l - 10), min(N + 1, r + 10)):

            # print(f"{x} {((A * x) // B) - (A * (x // B))}")
            ans = max(ans, ((A * x) // B) - (A * (x // B)))
        break

    mid = (l + r) // 2
    mid2 = (l + mid) // 2
    if calc(l) <= calc(mid2) and calc(mid2) <= calc(mid):
        l = mid
    elif calc(l) >= calc(mid2) and calc(mid2) <= calc(mid):
        r = mid
    else:
        if calc(mid2) >= calc(mid):
            r = mid

print(ans)

# for x in range(0, N + 1):
#     ans = max(ans, ((A * x) // B) - (A * (x // B)))

# print(ans)

Submission status: Accepted

Solution code:
def main():
    a,b,n = map(int,input().split(" "))
    p = a//b
    q = a%b

    if n < b:
        print(p*n+int(q*n/b))
    else:
        print(p*(b-1)+int(q*(b-1)/b))
main()

Submission status: Accepted

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

#n = int(input())
#l = list(map(int, input().split()))

'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''


a, b, n = map(int, input().split())
x=0
score=0
cnt=0
print(max(int(a*(min(b, n)-1)/b)-a*int((min(b, n)-1)/b),
      int(a*(min(b, n))/b)-a*int((min(b, n))/b)))

Submission status: Accepted

Solution code:
from math import floor
a,b,n = map(int,input().strip().split())
ans = floor((a*n)/b)-a*floor(n/b)
if n>b:
    ans = floor((a*(b-1))/b) - a*floor((b-1)/b)
elif n==b:
    ans = floor((a*(b-1))/b) - a*floor((b-1)/b)
print(ans)

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    a,b,n = LI()
    if b <= n+1:
        print((a*(b-1))//b)
        return
    print((a*n)//b-a*(n//b))
    return

#Solve
if __name__ == "__main__":
    solve()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

import math

x = min([B - 1, N])
print(math.floor(A*x/B) - A*math.floor(x/B))

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

a, b, n = 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:
def main():
  A, B, N = (int(_) for _ in input().split())
  k = A * N // B
  m = int(A - A/B)
  if k >= m: print(m)
  else:
    print(k)
  return

if __name__ == '__main__':
  main()

Submission status: Accepted

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

x = min(b - 1, n)

print(int(a * x / b))

Submission status: Accepted

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

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

Submission status: Accepted

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

if t == 0:
    ans = int(a * n / b) - a * int(n / b)
else:
    ans = 0
    for i in range(t):
        x = b * i + (b - 1)
        if x > n:
            x = n
        else:
            pass
        
        tmp = int(a * x / b) - a * int(x / b)
        
        if tmp > ans:
            ans = tmp
        else:
            break

print(ans)

Submission status: Accepted

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

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

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

print((a * x) // b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

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

    print(max)




if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a,b,n=map(int,input().split())
s=n//b
nmax = (a*n)//b - a*(n//b)
# b_n = b
# b_nn = 0
# while b_n <= n:
#     x = b_n -1
#     t = (a*x)//b - a*b_nn
#     if t > nmax:
#         nmax = t
#     b_n += b
#     b_nn +=1
if s>0:
    x = b*s-1
    t = (a*x)//b - a*(s-1)
    if t > nmax:
        nmax = t
print(nmax)

Submission status: Accepted

Solution code:
import math
import itertools
a,b,n = map(int,input().split())
pnt = 0
maxi = 0
if n>b:
    x = b-1
elif n ==b:
    x = n-1
else:
    x = n

#for x in range(1,n+1):
pnt = math.floor(a*x/b) - a*math.floor(x/b)
print(pnt)
#    if pnt > maxi:
#        maxi = pnt
#print(maxi)

Submission status: Accepted

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

Submission status: Accepted

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

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

answer = (a*n)//b - a*(n//b)
answer_x = 0

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

answer = max(answer, answer_x)

# print(x)
print(answer)

Submission status: Accepted

Solution code:
def input_int():
    return map(int, input().split())

def one_int():
    return int(input())

def one_str():
    return input()

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

from decimal import Decimal

A, B, N = input_int()



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

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

Submission status: Accepted

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

Submission status: Accepted

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


def f(n):
    return (A*n) // B - A * (n//B)


if B > N:
    print(f(N))
else:
    ans = f(N)
    N = N // B * B - 1
    ans = max(ans, f(N))
    print(ans)

Submission status: Accepted

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

import math


x = min(N, 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=input().split()
A=int(A)
B=int(B)
N=int(N)
if (1<=A<=10**6)and(1<=B<=10**12)and(1<=N<=10**12):
    if N<B:
        a=A*N/B
        a=math.floor(a)
        print(a)
    if N>=B:
        c=A-(A/B)
        c=math.floor(c)
        print(c)

Submission status: Accepted

Solution code:
import numpy as np
str = input()
lst = str.split()
a = int(lst[0])
b = int(lst[1])
c = int(lst[2])
if b > c:
    print(int(a*c/b)-int(c/b)*a)
else:
    d = int(c/b)
    if d > 100:
      d = 100
    lst = np.zeros(d)
    for i in range(d):
        k = b*(i+1)-1
        lst[i] = int(a*k/b)-int(k/b)*a
    print(int(np.max(lst)))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,B,N=map(int,input().split())
maxi=-10**9
#周期はB
if N<B:
  i = N
else:
  i = B-1
print( (A*i) // B - (A*(i // B)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
line = input().split(" ")
A = int(line[0])
B = int(line[1])
N = int(line[2])
max = 0
if B<N:
    K = B
    for i in range(-1, 2):
       if max< (int(A * (K + i) / B) - A * int((K + i) / B)):
           max = int(A * (K + i) / B) - A * int((K + i) / B)
else:
    K = N
    for i in range(-1, 1):
        if max< (int(A * (K + i) / B) - A * int((K + i) / B)):
            max = int(A * (K + i) / B) - A * int((K + i) / B)
print(max)

Submission status: Accepted

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

if b > n:
    x = n
else:
    x = n // b * b - 1
answer = max(0, (a*x)//b - a*(x//b))

print(answer)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b, n = map(int, input().split())
 
cand = []
 
def calc(n):
  return int(a*n/b)-a*int(n/b)
 
cand.append(calc(0))
cand.append(calc(1))
cand.append(calc(n))
cand.append(calc(max(0, n-1)))
cand.append(calc(max(0, b*(n//b) - 1)))
cand.append(calc(min(n, max(0, b-1))))

if b == 1:
  print(0)
else:
  print(max(cand))

Submission status: Accepted

Solution code:
from math import floor
a,b,n = map(int,input().split())
ans = 0
if n <= b:
    for i in range(max(0,n-9),n+1):
        ans = max(ans,floor(a*i/b) - a*floor(i/b))
else:
    for i in range(max(0,b-10),min(n,b+10)):
        ans = max(ans,floor(a*i/b) - a*floor(i/b))
print(ans)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

if b == 1:
    print(0);exit()

l = 0
r = n
while r - l > 100:
    rr = (l + 2*r)//3
    ll = (2*l + r)//3
    if f(ll) > f(rr):
        r = rr
    elif f(ll) < f(rr):
        l = ll
    else:
        l = ll

ans = -100
for i in range(l,r+1):
    ans = max(ans,f(i))
print(ans)

Submission status: Accepted

Solution code:
import numpy
# import matplotlib.pyplot as plt

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

x = min(N, B - 1)
s1 = int(numpy.floor(A * x / B))
s2 = A * int(numpy.floor(x / B))
print(s1 - s2)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import math
A,B,N=map(int,input().split())
if N>=B-1:
    ans=math.floor((B-1)*A/B)
    print(ans)
else:
    ans=math.floor(N*A/B)
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(100000000)


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

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


main()

Submission status: Accepted

Solution code:
import math

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

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

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#d
A,B,N=map(int,input().split())
b=[]
if N>=B:
    b.append((N//B)*B-1)
b.append(N)
a=0
for x in b:
    p=(A*x)//B-A*(x//B)
    if p>a:
        a=p
print(a)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
from math import floor


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

Submission status: Accepted

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

Submission status: Accepted

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

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

if B-1<=N:
    print func(B-1)
else:
    print func(N)

Submission status: Accepted

Solution code:
import sys
from math import factorial
from collections import Counter
from fractions import Fraction
import heapq, bisect, fractions
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
MOD = 10**9 + 7

A, B, N = MAP()

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

Submission status: Accepted

Solution code:
import numpy as np

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

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

print(ans)

Submission status: Accepted

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

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

if B > N:
    print(keisan(A, B, N))
else:
    print(keisan(A, B, B-1))

Submission status: Accepted

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

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

if B > N:
    ans = calc(N)
else:
    ans = calc(B-1)
print(ans)

Submission status: Accepted

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

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

ans = (A*x)//B
if B == 1:
    ans = 0

print(ans)

Submission status: Accepted

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

if B<=A:
    ans = 0
    for x in range(min(B, N+1)):
        ans = max(ans, A*x//B-x//B*A)
else:
    x = min(N, B-1)
    ans = A*x//B

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if N >= B - 1:
    x = B - 1
else:
    x = N
for a in range(1, A):
    if int(x/B + a/A) - int(x/B) != 0:
        result += 1

print(result)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math

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

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

Submission status: Accepted

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

if n < b:
    print(math.floor(a * n / b))
    exit(0)
print(f(a, b, b - 1))