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

Submission status: Accepted

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

Submission status: Accepted

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

def main(a,b,n):
    m=int(min(b,n)*a/b)+1
    maxdif=0
    for xx in range(0,m):
        if b*xx%a==0:
            x=b*xx//a
        else:
            x=int(b/a*xx)+1
        maxdif=max(maxdif,int(a*x/b)-a*int(x/b))
    return maxdif

if __name__=='__main__':
    a,b,n=readinput()
    ans=main(a,b,n)
    print(ans)

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 n>=(b-1):
  print(f(b-1))
else:
  print(f(n))

Submission status: Accepted

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


def calc(a,b,x):
    num = ((a*x)//b)-a*(x//b)
    return num


if B == N:
    X = N-1
    print(calc(A,B,X))
    sys.exit()
if B < N:
    X = B-1
    print(calc(A,B,X))
    sys.exit()
if B > N:
    X = N
    print(calc(A,B,X))
    sys.exit()

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

if __name__ == '__main__':
    main()

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

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

Submission status: Accepted

Solution code:
import math

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

M = 0
t = min(b-1, n)
M = math.floor(a*t/b) - a*math.floor(t/b)

print(M)

Submission status: Accepted

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

lst = []
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:
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())
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:
import math
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 sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

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

Submission status: Accepted

Solution code:
import sys
# from collections import defaultdict, deque
import math
# import copy
# from bisect import bisect_left, bisect_right
# import heapq

# sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline

getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = 10 ** 20
MOD = 1000000007

def solve():
    a, b, n = getList()
    if n >= b-1:
        x = b - 1
    else:
        x = n
    print(math.floor((a * x) / b) - a * math.floor(x/b))
    return
def main():
    n = getN()
    for _ in range(n):
        solve()
if __name__ == "__main__":
    # main()
    solve()

Submission status: Accepted

Solution code:
import sys
import math
def IL(): return map(int,sys.stdin.readline().rstrip().split())
 
def Main():
    a,b,n = IL()
    x = min(b-1,n)
    print(a*x//b)
    return
 
if __name__=='__main__':
    Main()

Submission status: Accepted

Solution code:
import sys
import math
def IL(): return map(int,sys.stdin.readline().rstrip().split())

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

if __name__=='__main__':
    Main()

Submission status: Accepted

Solution code:
# 分母Bについて周期性があり、さらに単調増加のため、
# Nが周期以下ならN、Nが周期を超えるならB-1を代入した値が答え
a,b,n =map(int,input().split())
import math
x = min(n, b-1)
print((a * x) // b - a * (x // b))

Submission status: Accepted

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

def f(x):
    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())

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
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))
    return
  if(n>=b):
    print(math.floor(a*(b-1)/b)-a*math.floor((b-1)/b))
    return
    
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:
import math

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

ans1 = (a*(b-1))//b
ans2 = (a*n)//b

print(min(ans1, ans2))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import floor


def main():
    A, B, N = map(int, input().split())
    if N >= B-1:
        x = B - 1
    else:
        x = N

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

def f(x):
    return (a*x)//b - a * (x//b)
if((b-1)>n):
    print(f(n))
else:
    print(f(b-1))

Submission status: Accepted

Solution code:
a,b,n=[int(x) for x in input().rstrip().split()]
if b<=n:
  n=b-1

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

Submission status: Accepted

Solution code:
import math
A,B,N = [int(x) for x in input().split(' ')]
if N/B >= 1:
  print(int(A+math.floor(-float(A)/float(B))))
else:
  print(int(math.floor(float(N)*float(A)/float(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:
A, B, N = map(int, input().split())
if N < B-1:
    x = N
else:
    x = B-1
print(int(A*x/B) - A*int(x/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)


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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def fact(n):
    ans = 1
    for i in range(2, n+1):
        ans*= i
    return ans
def comb(n, c):
    return fact(n)//(fact(n-c)*c)

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

Submission status: Accepted

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

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:
# D - Floor Function
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-1:
  ans = int(A*(B-1)/B)
else:
  ans = int(A*N/B)
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def main():
    A,B,N=tuple(map(int,sys.stdin.readline().split()))
    L=max([1,min([B-1,N])])
    print((A*L)//B) if B!=1 else print(0)
if __name__=='__main__':main()

Submission status: Accepted

Solution code:
import math

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

if N >= B-1:  # x = B-1のときに最大値
    beta = (B-1)/B
    print(math.floor(A * beta))

else:
    beta = N/B
    print(math.floor(A * beta))

Submission status: Accepted

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

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

print(ans)

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:
# N>=x>=0
# return max(floor(A*x/B)-A*floor(x/B))
# floor(t) は実数t以下の最大の整数
# x = Nの時が最大
# x/Bが一の直前になるようにとってみる
A, B, N = [int(i) for i in input().split()]
x = 0
if N >= B:
    x = B-1
else:
    x = N 
y = (A * x)// B - A * (x//B)
print(y)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

print(m)

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 math

a,b,c=list(map(int, input().split()))
if b<=c:
	print(math.floor(a*(b-1)/b))
else:
	print(math.floor(a*c/b)-a*(math.floor(c/b)))

Submission status: Accepted

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


if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
import math

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

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

ans = math.floor(a * x / b) - 5 * math.floor(x / b)

print(ans)

Submission status: Accepted

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

i=min(B-1,N)


tmp=(A*i)//B-A*(i//B)

        
print(tmp)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(100000)


def main():
    A, B, N = [int(i) for i in input().strip().split()]
    ans = 0
    if N >= B:
        if A >= B:
            n = range(B - 1, N + 1, B)[-1]
        else:
            n = range(B - 1, N + 1, B)[0]
        ans = ((A * n) // B) - (A * (n // B))
    else:
        ans = ((A * N) // B) - (A * (N // B))
    return ans


if __name__ == "__main__":
    print(main())

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

a,b,n = na()

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

Submission status: Accepted

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

Submission status: Accepted

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

if n < b:
    ans = a * n // b  
    print(ans)
    sys.exit()  
elif n == b:
    ans = a * (b-1) // b
    print(ans)
    sys.exit()

# n == 1のときは0 問題なし
r = n // b
ans = 0
# for i in range(1, r + 1):
#     t = i * b - 1
#     ans_t = a * t // b - (a * (i - 1))
#     ans = max(ans, ans_t) 
    # print(i, t, ans)

t = r * b - 1
ans_t = a * t // b - (a * (r - 1))
ans = max(ans, ans_t) 

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

print(ans)

Submission status: Accepted

Solution code:
"""
- floor function
- xは(0<=x<=B-1 && x<=N)を満たす最大数
"""
a,b,n=map(int,input().split())
 
x=min(n,b-1)
print((a*x)//b-a*(x//b))

Submission status: Accepted

Solution code:
from decimal import Decimal
import math
a,b,n = map(str,input().split())

a = Decimal(a)
b = Decimal(b)
n = int(n)
ans = 0
kouho = [min(b-1,n)]
for x in kouho:
    tmp = math.floor((a*x)/b) - a*math.floor(x/b)
    ans = max(ans,tmp)
print(ans)

Submission status: Accepted

Solution code:
"""
- floor function
"""
a,b,n=map(int,input().split())

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

Submission status: Accepted

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

A,B,n=map(int,input().split())
print(f(A,B,B-1)) if n>=B-1 else print(f(A,B,n))

Submission status: Accepted

Solution code:
import math
A,B,N = list(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)-A*math.floor((B-1)/B))

Submission status: Accepted

Solution code:
#n=int(input())
a,b,n=map(int,input().split())
#hl=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

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

Submission status: Accepted

Solution code:
import sys
from functools import lru_cache
from collections import defaultdict
inf = float('inf')
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**6)
def input(): return sys.stdin.readline().rstrip()
def read():
  return int(readline())
def reads():
  return map(int, readline().split())

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
import math

A, B, N = [int(x) for x in input().split()]
count = min(B-1, N)
a = math.floor(float(A*count)/B) - A * math.floor(float(count)/B)
print(a)

Submission status: Accepted

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

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

print(res)

Submission status: Accepted

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

#floor(A*x // B vs A * (x/B)
#x= pB + q (0<=q<B)
# Ap +(Aq// B)  - AP
x = B-1 if B<=N else N
print((A*x) // B)

Submission status: Accepted

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

Submission status: Accepted

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

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

if B <= N:
  x = B - 1
else:
  x = N
    
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:
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

a,b,n=nm()

import math

print(math.floor(a*(min(b-1,n)%b)/b))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from sys import stdin


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
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 S(): return input()
def LS(): return input().split()


a, b, n = LI()
x = b - 1 if b - 1 <= n else n
print(int(a * x / b) - a * int(x / b))

Submission status: Accepted

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

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

if n < b - 1:
    max = f(n)
elif b == 1:
    max = 0
else:
    x = b - 1
    max = f(x)
    while x <= n:
        if max < f(x):
            max = f(x)
        x += b

print(max)

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:
import sys
import itertools
# import numpy as np
import time
import math

sys.setrecursionlimit(10 ** 7)

from collections import defaultdict

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

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

Submission status: Accepted

Solution code:
import math
import sys
x=input()
x0=x.split()
a=int(x0[0])
b=int(x0[1])
n=int(x0[2])
b0=n%b
b1=0
q1=0
if b==1:
    print(0)
    sys.exit()
for i in range(1,math.floor(n/b)+1):
    b1=b*i-1
    q1=max(q1,math.floor(a*b1/b)-a*math.floor(b1/b))
q2=math.floor(a*b0/b)-a*math.floor(b0/b)
print(max(q1,q2))

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

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

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

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

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())
def f(x): 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())
if n < b:
    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 f(x):
    return floor(a*x/b) - a*floor(x/b)
print(f(min(n, b-1)))

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):
  x = B - 1
else:
  x = N

'''
print(x)
'''

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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


def solve(A: int, B: int, N: int):
    if A == 1: return 0

    if N < B:
        x = N
    else:
        md = N % B
        x = int(N - (md + 1))
    return int((A*x)//B) - A * int(x//B)

    # m = -1
    # for i in range(N+1):
    #     x = i
    #     m = max([m, int((A*x)/B) - A * int(x/B)])
    # return m


# 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
    # N = pow(10, 9)
    print(solve(A, B, N))

if __name__ == '__main__':
    main()

Submission status: Accepted

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


if B < N:
    Max = int(A*(B-1)/B)
    X = int(N/B)
    fx = int(A*(B*X-1)/B) - A * int((B*X-1)/B)
    # Max = max(fx,Max)
    # for x in range(1,X):
    #     fx = int(A*x/B) - A * int(x/B)
    #     Max = max(Max,fx)
elif B == N:
    Max = int(A*(B-1)/B)
else:
    Max = int(A*N/B)
print(Max)

Submission status: Accepted

Solution code:
import sys
from io import StringIO
import unittest
import math


# 検索用タグ、広義単調増加
def resolve():
    a, b, n = map(int, input().split())

    x = min(b - 1, n)

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

    print(int(ans))


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """5 7 4"""
        output = """2"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """11 10 9"""
        output = """9"""
        self.assertIO(input, output)


if __name__ == "__main__":
    # unittest.main()
	resolve()

Submission status: Accepted

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

ans = 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 = int(A/B*x)-A*int(x/B)
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

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

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 sys
def input():
    return sys.stdin.readline()[:-1]


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


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

Submission status: Accepted

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

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

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

    res=floor(res_x,A,B)
    print(res)

if __name__=="__main__":
    main()

Submission status: Accepted

Solution code:
import math
A,B,N = list(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))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  # floor(x/b)がギリギリ割り切れない辺りが一番大きくなりそう
  # -> 実験してみるとmath.floor(a*x/b)-a*math.floor(x/b)はループしてそう
  # -> 答えはfloor(x/b)がギリギリ割り切れないときの値に決め打つぜ！
  a,b,n=LI()
  x=min(n,b-1)
  return math.floor(a*x/b)-a*math.floor(x/b)

# main()
print(main())

Submission status: Accepted

Solution code:
# x = iB + j とすると
# floor(A(iB + j) / B) - A * floor((iB + j/)B)
#   = A * i + floor(A * j / B) - A * i - A * floor(j / B)
#   = floor(A * j / B)
# なので, A * j が最大の時, floor(Ax/B) - A * floor(x/B) は最大となる.
# 0 <= j < B なので, x の値は
#   N < B の時, x = N, N >= B の時 x = B - 1
# となる.


from math import floor


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


if __name__ == '__main__':
    solve()

Submission status: Accepted

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

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

print(max_value)

Submission status: Accepted

Solution code:

from math import floor

def parse():
  return map(int, input().split(" "))

def main():
  A, B, N = parse()
  
  x = B - 1 if B - 1 <= N else N
  print(floor((A * x) / B) - A * floor(x / B))
  exit(0)

  limit_N = 5000000
  N = limit_N if N > limit_N else N

  x = 0
  max_val = floor((A * x) / B) - A * floor(x / B)

  for x in range(1, N + 1):
    val = floor((A * x) / B) - A * floor(x / B)
    if max_val < val:
      max_val = val

  print(max_val)


if __name__ == "__main__":
  main()

Submission status: Accepted

Solution code:
from sys import stdin
input = stdin.readline
 
a,b,n = map(int,input().split())
maxpoint = 0
 
if b > n  :
    tmp = int((a * n) / b)  - a * int(n/b) 
    maxpoint = max(tmp,maxpoint)
else:
    k = int(n/b)*b -1
    maxpoint =  int((a * k) / b)  - a * int(k/b) 
    if b == 1:
        maxpoint = 0
 
print(maxpoint)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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

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

Submission status: Accepted

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

val = math.floor(A*x/B)
print(val)

Submission status: Accepted

Solution code:
from math import floor

def f(x):
    return floor(A*x/B)-A*floor(x/B)
A, B, N = 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)