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


def solve(a: int, b: int, n: int) -> int:
    x = min(n, b - 1)
    return math.floor(a * ((x / b) - int(x / b)))


def main():
    input = sys.stdin.buffer.readline
    a, b, n = map(int, input().split())
    print(solve(a, b, n))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import sys
from collections import deque
import copy
import math
def main():
    A, B, N = map(int, input().split())
    if B - 1 <= N:
        x = B - 1
    else:
        x = N
    ans = math.floor(A * x / B) - A * math.floor(x / B)
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

left=1
right=n
for _ in range(100):
    delta=(right-left)/3
    midl=left+delta
    midr=midl+delta
#    print(f'left={left} midl={midl} midr={midr} right={right}')
    if f(midl)>f(midr):
        right=midr
    else:
        left=midl
print(max(f(int(midl)),f(min(int(midl)+1,n))))

Submission status: Accepted

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

f=lambda x: (A*x)//B+A*(x//B)

if B>N:
    print(f(N))
else:
    print(f(B-1))

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
from math import floor
from sys import stdin
A, B, N = [int(_) for _ in stdin.readline().rstrip().split()]
def solve(x):
    return floor(A*x/B)-A*floor(x/B)
print(solve(min(B-1, N)))

Submission status: Accepted

Solution code:
def solve(a, b, n):
    return a * min(b-1, n) // b - a * (min(b-1, n) // b)


def solve_baka(a, b, n):
    ans = -1e9
    for x in range(n+1):
        ans = max((a * x) // b - a * (x//b), ans)
        print('    ', x, (a * x) // b - a * (x//b))
    return ans


def main():
    a, b, n = [int(v) for v in input().split()]
    print(solve(a, b, n))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import floor

A, B, N = map(int, input().split())
i = min(B - 1, N)
f_i = floor(A * i / B) - A * floor(i / B)

print(f_i)

Submission status: Accepted

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

if n <= b - 1:
    x = n
else:
    x = n - (n%b + 1)

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

Submission status: Accepted

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

Submission status: Accepted

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


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


if n < b:
    print(calc(n))
else:
    print(calc(b-1))

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

Submission status: Accepted

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

def ma(k):
    s = a * k / b
    t = k / b
    ss = s // 1
    tt = (t // 1) * a
    return ss - tt

if(n < b):
    print(str(int(ma(n))))
else:
    print(str(int(ma(b-1))))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
a, b, n = map(int, input().split())
x = min(n, b - 1)
print(a * x // b - a * (x // b))

Submission status: Accepted

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

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

Submission status: Accepted

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

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

if N < B:
    print(calc(N))
else:
    print(calc(B - 1))

Submission status: Accepted

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import numpy as np


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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
import math

readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda: readline().rstrip() # input string
ni = lambda: int(readline().rstrip()) # input int
nm = lambda: map(int, readline().split()) # input multiple int 
nl = lambda: list(map(int, readline().split())) # input multiple int to list

a, b, n = nm()

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

Submission status: Accepted

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

Submission status: Accepted

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

# f(x+B) = f(x)
# 単調増加
x = min(B-1, N)
ans = (A*x)//B - A*(x//B)
print(ans)

Submission status: Accepted

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

x=min(N,B-1)

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

Submission status: Accepted

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

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

Submission status: Accepted

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

if x == -1:
    x = n

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

Submission status: Accepted

Solution code:
import math
A,B,N = map(int,input().split())
siki = 0
k = math.floor(N/B)
m = k*B
if (B-1) <= N:
    siki = math.floor((A*(B-1))/B)-A*math.floor((B-1)/B)
elif B>N:
    siki = math.floor((A*N)/B)-A*math.floor((N/B))

print(siki)

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 sys
sys.stdin.readline

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

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

print(A * ans //B)

Submission status: Accepted

Solution code:
from math import floor

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

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

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 = list(map(int, input().split()))
n = min(N, B-1)
ans = int(A*n/B) - A * int(n/B)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

### floor(x / B) が0のうち最もxが大きい時が正解であると仮定する
if B <= N:
    result = floor(A * (B - 1) / B) - A * floor((B - 1) / B)
else:
    result = floor(A * N / B) - A * floor(N / B)
print(result)

Submission status: Accepted

Solution code:
from sys import stdin, setrecursionlimit


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

    x = min(b - 1, n)

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


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

Submission status: Accepted

Solution code:
from sys import stdin, setrecursionlimit


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

    ans = 0

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

    print(ans)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

Submission status: Accepted

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

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

ans = f(min(b - 1, n))
print(ans)

Submission status: Accepted

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

def floor(t):
    return int(t)

list = []

if N+1 > B:
    print(floor((A*(B-1))/B) - A*floor((B-1)/B))
else:
    print(floor((A*N/B) - A*floor(N/B)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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

def calc(a,b,c):
    print(math.floor(a * c / b) - a * math.floor(c / b))

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

calc(a,b,c)

Submission status: Accepted

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

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
ans = floor(a*x/b) - a*floor(x/b)
print(ans)

Submission status: Accepted

Solution code:
def floor(a):
    return int(a)

if __name__ == '__main__':
    abn = input()
    abn = abn.split()
    a = int(abn[0])
    b = int(abn[1])
    n = int(abn[2])

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

    print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

Solution code:
def solve(string):
    a, b, n = map(int, string.split())
    return str(a * n // b) if b > n else str(a * (b - 1) // b)


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))

Submission status: Accepted

Solution code:
def solve(string):
    a, b, n = map(int, string.split())
    return str(a * (b - 1) // b) if b <= n else str(a * n // b)


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))

Submission status: Accepted

Solution code:
A, B, N = [ int(i) for i in input().strip().split(' ')]
max_floor = 0
if B > N:
    max_floor = int(A * N / B) - A * int(N/B)
    print(max_floor)
else:
    floor = int(A * (B-1) / B) - A * int((B-1)/B)
    if max_floor < floor:
        max_floor = floor
    print(max_floor)

Submission status: Accepted

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

Submission status: Accepted

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

def floor(x):
  return x//1

if N >= B-1:
  x = B-1
elif N < B-1:
  x = N

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

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

def floor(t):
  return math.floor(t)

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

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

Submission status: Accepted

Solution code:
from math import floor


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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
A, B, N = map(int, input().split())
ans = 0
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
x = min(B-1, N)
print((A*x)//B-A*(x//B))

Submission status: Accepted

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

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

Submission status: Accepted

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

if n < b:
    score = math.floor(a*n/b) - a * math.floor(n/b)
    print(score)
    
else:
    max_score = -10000
    for i in range(1,10):
        x = (b-1)*i
        score = math.floor(a*x/b) - a * math.floor(x/b)
        max_score = max(max_score, score)
    print(max_score)

Submission status: Accepted

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

Submission status: Accepted

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

else:
    print(int(A * N/B))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

x=min(N,B-1)

Ans=int(A*x/B)-A*int(x/B)
#print(Ans)
print(Ans)

Submission status: Accepted

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

Submission status: Accepted

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

from math import floor
# ans = -1
# for x in range(N+1):
#     r = floor(A*x/B) - A * floor(x/B)
#     # print(ans, r)
#     print(x, r)

# print('---')

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

print(ans)

Submission status: Accepted

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

x =min(N,B-1)

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

print(result)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

x1 = max(n - n % b - 1, 0)
x2 = n
ans = max(((a * x1) // b) - (a * (x1 // b)), ((a * x2) // b) - (a * (x2 // b)))

#print(x1, x2)
print(ans)

Submission status: Accepted

Solution code:
def main():
    A, B, N = [int(x) for x in input().split()]
    if N >= B-1:
        return A*(B-1)//B
    return A*N//B


print(main())

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a,b,n = [int(x) for x in 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())

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

w=min(n,b-1) 
ma=f(w)
print(ma)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/python3
# -*- coding: utf-8 -*-
a, b, n = map(int, input().split())
max_score = 0
if n < b:
    max_score = int(a * n / b) - a * (n // b)
elif n == b:
    max_score = int(a * (n-1) / b) - a * ((n-1) // b)
elif a <= b:
    max_score = a - 1
elif a >= b:
    max_score = int(a * (b-1) / b) - a * ((b-1) // b)
print(max_score)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#わかんなかった
import math
a, b, n = map(int, input().split())

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

Submission status: Accepted

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

if B == 1:
  print(0)
else:
  if N >= B-1:
    x = math.floor(A-A/B)
    y = A - math.ceil(A/B)
    ans = max(x,y)
    print(ans)
  else:
    print(math.floor(A*N/B))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import floor

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 6)  # 再帰関数の再帰の深さを設定
to_index = lambda x: int(x) - 1  # 入力した数字に1を引いたものを返す
print_list_in_2D = lambda x: print(*x, sep="\n")  # リストの要素を改行を挟んで表示する関数

# 入力を整数に変換して受け取る
def input_int():
    return int(input())

def map_int_input():
    return map(int, input())

MII = map_int_input

def MII_split():
    return map(int, input().split())

def MII_to_index():
    return map(to_index, input())

def MII_split_to_index():
    return map(to_index, input().split())

# 入力全てを整数に変換したものの配列を受け取る
def list_int_inputs():
    return list(map(int, input()))

LII = list_int_inputs

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

# 2次元リスト化
def LII_2D(rows_number):
    return [LII() for _ in range(rows_number)]

def LII_split_2D(rows_number):
    return [LII_split() for _ in range(rows_number)]

import math

A, B, N = MII_split()

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

# max = 0
# for x in range(min(B + 1, N + 1)):
#     if x > N:
#         break
#     fx = f(x)
#     # print(fx)
#     if fx > max:
#         max = fx
print(f(min(B-1, N)))

Submission status: Accepted

Solution code:
A,B,N = [int(i) for i in input().split()]
t = min([N,B-1])
print((A*t//B))

Submission status: Accepted

Solution code:
A,B,N = [int(i) for i in input().split()]
t = min([N,B-1])
print((A*t//B))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# D
# Floor Function

import math

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

x = min(B-1,N)

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
"""
~~ author : dokueki
~~ created : 07~05~2020
"""

import sys
INT_MAX = sys.maxsize
INT_MIN = -(sys.maxsize)-1
sys.setrecursionlimit(10**7)
mod = 1000000007


def IOE():
    sys.stdin = open("input.txt", "r")
    sys.stdout = open("output.txt", "w")


def Try():
    a, b, n = map(int, sys.stdin.readline().split())
    x = min(b - 1, n)
    print((a*x)//b - a*(x//b))


def main():
    Try()


if __name__ == "__main__":
    try:
        IOE()
    except:
        pass
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
from decimal import *
sys.setrecursionlimit(10**6)


def main(input, print):
    a, b, n = map(Decimal, input().split())
    l = 0
    r = n
    ans = math.floor(a*n/b) - a*math.floor(n/b)
    while r-l > 1:
        mid = (l+r)//2
        t = math.floor(a*mid/b) - a*math.floor(mid/b)
        if ans > t:
            r = mid
        else:
            ans = t
            l = mid

    print(ans)


if __name__ == '__main__':
    main(sys.stdin.readline, print)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

print(A*x//B)

Submission status: Accepted

Solution code:
# D - Floor Function

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())
x = min(b -1, n)
ans = int(a * x/ b)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    A, B, max_v = map(int, input().split())

    x = min((B-1), max_v)
    answer = A * x // B

    print(answer)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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


print(a)

Submission status: Accepted

Solution code:
def q4():
    import math
    A, B, N = (int(i) for i in input().split())
    x = B - 1 if N >= B else N
    ans = math.floor(x*A//B) - A * math.floor(x//B)
    return ans
 
 
if __name__ == '__main__':
    ans = q4()
    print(ans)

Submission status: Accepted

Solution code:
def q4():
    import math
    A, B, N = (int(i) for i in input().split())
    x = B - 1 if N >= B else N
    ans = math.floor(x*A//B) - A * math.floor(x//B)
    return ans


if __name__ == '__main__':
    ans = q4()
    print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math

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

left, right = 0, n
# 答えが整数になる場合このrightとleftの幅を3未満にするとバグる
while abs(right - left) > 3:
    mid1 = (right * 2 + left) // 3 + 1
    mid2 = (right + left * 2) // 3
    if f(mid1) <= f(mid2):
        # 上限を下げる（最小値をとるxはもうちょい下めの数だな）
        right = mid1
    else:
        # 下限を上げる（最小値をとるxはもうちょい上めの数だな）
        left = mid2
ans = 0
for i in range(left, right + 1):
    ans = max(ans, f(i))
# f(0), f(x)もジャッジしないとバグる
print(max(ans, f(0), f(n)))

Submission status: Accepted

Solution code:
import math

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

left, right = 0, n
# 答えが整数になる場合このrightとleftの幅を3未満にするとバグる
while abs(right - left) > 3:
    mid1 = (right * 2 + left) // 3 + 1
    mid2 = (right + left * 2) // 3
    if f(mid1) <= f(mid2):
        # 上限を下げる（最小値をとるxはもうちょい下めの数だな）
        right = mid1
    else:
        # 下限を上げる（最小値をとるxはもうちょい上めの数だな）
        left = mid2
ans = 0
for i in range(left, right + 1):
    ans = max(ans, f(i))
print(max(ans, f(0), f(n)))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys,math
#sys.setrecursionlimit(100000000)
input = sys.stdin.readline
 
############ ---- USER DEFINED INPUT FUNCTIONS ---- ############
def inp():
    return(int(input()))
def inara():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split()))
################################################################
############ ---- THE ACTUAL CODE STARTS BELOW ---- ############

a,b,n=invr()
ans=-1

hi=n
lo=0

while hi>=lo:
	mid=(hi+lo)//2
	temp=(a*mid)//b-a*(mid//b)
	if temp>=ans:
		lo=mid+1
		ans=temp
	else:
		hi=mid-1
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Nomin = floor(A/B*N)

print(Nomin)

Submission status: Accepted

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

if b <= n:
    beta = ( b-1 )/b - int( ( b-1 )/b )

elif b > n:
    beta = n/b - int( n/b )

ans = int( a * beta )
print( ans )

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input().split(' ')
a = int(s[0])
b = int(s[1])
n = int(s[2])

i = min(b-1, n)
ans = 0
d1 = (a * i) // b
d2 = (i // b)
ans = d1 - (a * d2)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import  math

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

Submission status: Accepted

Solution code:
A, B, N = [int(_) for _ in input().split()]
x = min(B-1, N)
print((A * x) // B)

Submission status: Accepted

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

m = min(b-1, n)

print(a * m // 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)
print(f(min(N,B-1)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def i():
    return int(input())
def i2():
    return map(int,input().split())
def s():
    return str(input())
def l():
    return list(input())
def intl():
    return list(int(k) for k in input().split())

a,b,n=i2()
if b<=n:
	print( a*(b-1)//b )
else:
	print( a*n//b )

Submission status: Accepted

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

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())
print(int(A * min(N, B-1)/ B))