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:
#!/usr/bin/env python3
def main():
    import sys

    input = sys.stdin.readline

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from math import floor
def main():
    a, b, n = map(int, input().split())
    if n < b:
        x = n
    else:
        x = b - 1
    r = floor(a * x / b) - a * floor(x / b)
    print(r)

if __name__ == '__main__':
    main()

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import sys
import collections
import bisect


def main():
    a, b, n = map(int, input().split())
    i = max(b - 1 if n >= b else n, 1)
    print(math.floor(a * i / b) - a * math.floor(i / b))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

term1 = (a * x) // b
term2 = a * (x // b)

print(term1 - term2)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(f(a,b,min(b-1, n)))

Submission status: Accepted

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

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

m = math.floor(a*x/b) - a*math.floor(x/b)
print(m)

Submission status: Accepted

Solution code:
from math import floor

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

a, b, n = (int(x) for x in input().split())
if n < b:
    print(f(n))
else:
    print(f(b - 1))

Submission status: Accepted

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

Submission status: Accepted

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


def II():
    return int(sys.stdin.readline())


def MI():
    return map(int, sys.stdin.readline().split())


def LI():
    return list(map(int, sys.stdin.readline().split()))


def main():
    a, b, n = MI()
    ans = 0
    if n < b:
        ans = (a * n) // b
    else:
        ans = (a * (b - 1)) // b

    print(ans)


main()

Submission status: Accepted

Solution code:
A, B, N = map(int, input().split())
Ans = []
X = B * (N // B)
if X != 0:
    ans_1 = (A * (X - 1) // B) - A * ((X - 1) // B)
else:
    ans_1 = 0
ans_2 = (A * N // B) - A * (N // B)
Ans.append(ans_1)
Ans.append(ans_2)

print(max(Ans))

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

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

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

Submission status: Accepted

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

print((a*x)//b)

Submission status: Accepted

Solution code:
from math import floor

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

max_v = 0
if n < b:
  max_v = floor(a * n / b)
else:
  if b != 1:
    for i in range(b - 1, n + 1, b):
      j = 0
      t = floor(a * i / b) - a * j
      if t > max_v:
        max_v = t
      j += 1
print(max_v)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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

x=min(B-1,N)
f1=math.floor(A*x/B)
f2=A*math.floor(x/B)
result=f1-f2
print(result)

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:
A,B,N = map(int,input().split())
def f(x):
  f = int((A*x)/B)-A*int(x/B)
  return f
if(B-1 < N):
  print(f(B-1))
else:
  print(f(N))

Submission status: Accepted

Solution code:
import math

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

result=-1

x=min(B-1,N)
f1=math.floor(A*x/B)
f2=A*math.floor(x/B)
r=f1-f2
print(r)

Submission status: Accepted

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

if i==0:
    print(han)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


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

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


if(__name__ == '__main__'):
  main()

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
import math

def resolve(in_):
    a, b, n = map(int, next(in_).split())
    x = min(b - 1, n)
    return math.floor(a * x / b) - a * math.floor(x / b)


def main():
    answer = resolve(sys.stdin.buffer)
    print(answer)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

ans_1 = (A*x)//B
ans_2 = A*(x//B)

ans=ans_1-ans_2
print(ans)

Submission status: Accepted

Solution code:
import sys
import math
from collections import defaultdict,deque
from itertools import permutations
ml=lambda:map(int,input().split())
ll=lambda:list(map(int,input().split()))
ii=lambda:int(input())
ip=lambda:list(input())
ips=lambda:input().split()
sys.setrecursionlimit(10**6)
"""========main code==============="""

t=1
for _ in range(t):
    a,b,c=ml()
    d=(c+1)//b
    d*=b
    if(d!=0):
        d-=1
    else: d=c    
    print((a*d)//b-a*(d//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 = -1
if n < b:
    ans = (a * n // b) - a * (n // b)

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

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(f)

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

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

print(Max)

Submission status: Accepted

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

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())
if n<b:
  print((a*n)//b)
else:
  print((a*(b-1)//b))

Submission status: Accepted

Solution code:
a,b,n = list(map(int, input().split()))
t = 0
n = min(b-1,n)

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

Submission status: Accepted

Solution code:

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

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

Submission status: Accepted

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

# 0,1,2..B-1 毎の繰り返しとなる
# Nの範囲で、最大はB-1が最大となるので、 min(N, B-1)

x = min(N, B-1)
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 B>N:
  print(A*N//B)
else:
  print(A*(B-1)//B)

Submission status: Accepted

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

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

Submission status: Accepted

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


if N//B == 0:
    ans_i = N
else :
    ans_i = B*(N//B)-1

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

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math

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

# f(x)=f(x+B)となる(周期性)
# ex. A=5,B=7の時　0,0,1,2,2,3,4,0,0,...
# f(x)は（広義）単調増加
# f(B-1)を取りたいところだが、xはN以下の制限より、答えはf(min(B-1,N))

# 引数を確定させる
temp = min(B - 1, N)

ans = math.floor(A * temp / B) - A * math.floor(temp / B)
print(ans)

Submission status: Accepted

Solution code:
#import numpy as np
#import math
#from decimal import *
#from numba import njit
from math import floor

#@njit
def main():
    A,B,N = map(int, input().split())
    
    def f(x):
        return floor(A*x/B)-A*floor(x/B)

    print(f(min(N, B-1)))
main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
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:
#!/usr/bin/env python3
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


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


def main():
    solve()


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys,math,collections,itertools
input = sys.stdin.readline

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

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

Submission status: Accepted

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

def main():

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

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

    num = n//b

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,n = map(int, input().split())
yuka = lambda a,b: (a-(a%b))//b

x = min(n,b-1)
score = yuka(a*(x%b),b)
ans = score

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

if n < b:
    x = n
else:
    x = b - 1
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:
  print(0)
else:
  N = min(N, B-1)
  print(A*N // B)

Submission status: Accepted

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

ans=-100000
for x in range(A):
  #print(A//B,x//B,A*x//B,A*x//B-A*(x//B))
  ans=max(ans,(A*x//B)-A*(x//B))
  if x==N:break
x=B-1
if x>N:x=N
ans=max(ans,(A*x//B)-A*(x//B))
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

if A == 1: print(0)
elif B == 1: print(0)

else:
  if N ==1: x=1
  elif N < B: x = N
  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())
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())
 
 
def calc(a, b, n):
    return int(math.floor((a * n)/b) - (a * math.floor(n/b)))
 
if n <= b -1:
  print(calc(a,b,n))
else:
  print(calc(a,b,b-1))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def eq1(A,B,x):
    temp = (A*x)
    temp //= B
    return temp

def eq2(A,B,x):
    temp = x//B
    temp = temp*A
    return temp

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

    if B <= N:
        x = B-1
        ans = eq1(A,B,x) - eq2(A,B,x)
        return ans
    else:
        x = N
        ans = eq1(A,B,x) - eq2(A,B,x)
        return ans

print(main())

Submission status: Accepted

Solution code:

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

def func(t):
    return int(t)

#NはBより大きいかもしれないし小さいかもしれない
#B-1が最高だが、NがB-1より小さいとどうしようもない
x=min(B-1,N)
print(func(A*x/B)-A*func(x/B))

Submission status: Accepted

Solution code:
import sys
def Ii():return int(sys.stdin.buffer.readline())
def Mi():return map(int,sys.stdin.buffer.readline().split())
def Li():return list(map(int,sys.stdin.buffer.readline().split()))

a,b,n = Mi()
if b-1 < n:
  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)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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


# 持っているビスケットを叩き、1枚増やす
# ビスケット A枚を 1円に交換する
# 1円をビスケット B枚に交換する
def main():
    a, b, n = input_list()
    x = min(b-1, n)
    aa = math.floor((a*x)/b) - (a * math.floor(x/b))
    print(aa)

def bi(num, a, b, x):
    print((a * num) + (b * len(str(b))))
    if (a * num) + (b * len(str(b))) <= x:
        return False
    return True

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


def input_list_str():
    return list(map(str, input().split()))


if __name__ == "__main__":
    main()

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

s1 = (a*n)//b - a*(n//b)
x = max(1,n - n % b - 1)
s2 = (a*x)//b - a*(x//b) 

print(max(s1,s2))

Submission status: Accepted

Solution code:
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())
# A,B,N=11, 10, 5

ans=0

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

print(ans)

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

c = int(a*n/b) - a*int(n/b)

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

Submission status: Accepted

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

Submission status: Accepted

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

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

if B-1 <= N :
    print(max(f(B-1) , f(N)))
else : 
    print(f(N))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
input = lambda: sys.stdin.readline().rstrip()

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from collections import defaultdict as dd
from collections import deque
import bisect
import heapq

def ri():
    return int(input())

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


def solve():
    a,b,n = rl()
    if n >= b:
        ans = (a * (b - 1)) // b - a * ((b - 1) // b)
    else:
        ans = a * n // b

    print (ans)






mode = 's'

if mode == 'T':
    t = ri()
    for i in range(t):
        solve()
else:
    solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
def gcd(*numbers): reduce(math.gcd, numbers)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0

A, B, N = I()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
from math import ceil, floor, log2
# from collections import deque
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np    # cumsum
# from bisect import bisect_left, bisect_right

def solve():
    A, B, N = MI()

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

if __name__ == '__main__':
    solve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate, combinations_with_replacement, compress
import sys
import math
import bisect


def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.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)


def main():
    A, B, N = LI()
    print(int(A / B * min(N, B - 1)))


main()

Submission status: Accepted

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

x = min(b-1,n)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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

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

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

print(answer)

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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

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

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

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()

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

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

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

Submission status: Accepted

Solution code:
a,b,n=map(int,input().split())
if b>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:
a, b, n = map(int, input().split())

if b>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:
A,B,N=map(int,input().split())

max = 0
if B - 1 >= N:
    i = N
else:
    i = B - 1
ans = A*i//B - A*(i//B)

print(ans)

Submission status: Accepted

Solution code:
import math
A, B, N = map(int, input().split())
ans = []
if B-1<N:
    sahen = math.floor(A*(B-1)//B)
    uhen = math.floor((B-1)//B)
    uhen = uhen*A
    ans.append(sahen-uhen)

sahen = math.floor(A*N//B)
uhen = math.floor(N//B)
uhen = uhen*A
ans.append(sahen-uhen)

print(max(ans))

Submission status: Accepted

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

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:
a, b, n = [int(x) for x in input().split()]

n = min(n,b-1)
x = max(0,n-a-a-a-a)

s = -a

for i in range(x,n+1):
    s = max(s,(a*i//b)-a*(i//b))



print(s)

Submission status: Accepted

Solution code:
import math

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

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

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

Submission status: Accepted

Solution code:
import math

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

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

ans = [math.floor(a*x/b) - a*math.floor(x/b)]
ans.append(math.floor(a*(x-1)/b) - a*math.floor((x-1)/b))
if x < n:
    ans.append(math.floor(a*(x+1)/b) - a*math.floor((x+1)/b))

print(max(ans))

Submission status: Accepted

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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import floor, ceil

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

num = min(b-1, n)
#n以下で最大のbの倍数
print(floor(a*num/b) - a*floor(num/b))



# ans = 0
# for i in range(1,100):
#     tmp = floor(a*i/b) - a*floor(i/b)
#     print("i", i, "tmp", tmp)
#     ans = max(ans, tmp)


# if a > b:
#     print(floor(a-a/b))
# elif a<b:
#     print(ceil(b/a))
# else:
#     print(a-1)

Submission status: Accepted

Solution code:
import math

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

print(f(a,b,min(b-1,n)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC 165 D - Floor Function

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

def func(i):
    return int(i*a/b) - a*int(i/b)

print(func(min(b-1, n)))