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()))
ans = 0
if B+1 < N:
    C = B+1
else:
    C = N
if B//A == 0:
    D = 1
else:
    D = B//A
#floor()の中のiをD分スキップしても、全てのfloor()値を表現できる。
for i in range(1, C+D, D):
    val = math.floor(A*i/B) - A*math.floor(i/B)
    #print("i", i, "val", val)
    ans = max(ans, val)

print(ans)

Submission status: Accepted

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math

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

x = (n//b)*b-1
if(x<=0):
  x=n
t= (a*x)//b - a*(x//b)

print(t)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# @oj: atcoder
# @id: hitwanyang
# @email: 296866643@qq.com
# @date: 2020-05-04 00:24
# @url:https://atcoder.jp/contests/abc165/tasks/abc165_d
import sys,os
from io import BytesIO, IOBase
import collections,itertools,bisect,heapq,math,string
# region fastio

BUFSIZE = 8192

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
# ------------------------------
def main():
    abn=list(map(int,input().split()))
    a,b,n=abn[0],abn[1],abn[2]
    # print (a,b,n)
    mn=min(b-1,n)
    print (a*mn//b-a*(mn//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 N >= B:
    print(f(B-1))
else:
    print(f(N))

Submission status: Accepted

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


def solve(A: int, B: int, N: int):
    # max[A * x // B - A *(x // B)]
    # x <= N
    # x = pB + r -> Ar // B
    r = B-1 if B < N else N - 1 if B == N else N
    ans = (r * A) // B
    print(ans)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    solve(A, B, N)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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

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

Submission status: Accepted

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

Submission status: Accepted

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

def solve(i):
  return A * i // B - A * (i // B)

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

Submission status: Accepted

Solution code:
A, B, N =map(int, input().split())
"""直感的にはAxがちょうどBの倍数になった時　or　超えた時が大きくなりそう？それだけで探索する
ほとんどは同じ値になる A,Bの値が小さくNがでかい時、死ぬ
xの増加による挙動は 4パターンしかない
不等式から最大値は高々Aであるとわかる　それで探索する？"""
"""解説：
f (x) = f loor(Ax/B) − A × f loor(x/B) とします。
f(x + B) = f(x) であることは実際に代入することで容易に分かります。なので、0 ≤ x ≤ B − 1 の場合のみを考えます。
このとき、f (x) = f loor(Ax/B) − A × f loor(x/B) = f loor(Ax/B) で、f loor(Ax/B) は広義単 調増加なので、与えられた制約 (0 ≤ x ≤ B − 1, 0 ≤ x ≤ N) の中で最も大きい x について、f(x) が求める最大値です。
よって、答えは f (min(B − 1, N )) です。
単純に数学的事実を使うだけの問題"""

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
'''
参考
https://drken1215.hatenablog.com/entry/2020/05/02/225600

int(A*x/B) - A * int(x/B) の値は、Bごとに周期的になる
よって、x = min(B-1, N)となる
'''
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 = list(map(int, input().split()))
ans = 0
if B+1 < N:
    C = B+1
else:
    C = N
if B//A == 0:
    D = 1
elif B//A > 1:
  	D = B//A-1
else:
    D = B//A
for i in range(1, C+1, D):
    val = math.floor(A*i/B) - A*math.floor(i/B)
    #print("i", i, "val", val)
    ans = max(ans, val)

print(ans)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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())
#ans = 0
#for x in range(N+1):
    #print(x,(A*x)//B - A*(x//B))
    #if ans < (A*x)//B - A*(x//B):
    #    ans = (A*x)//B - A*(x//B)
if B-1 > N:
    x = N
else:
    x = 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 int(a*x/b)-a*int(x/b)
print(f(min(b-1,n)))

Submission status: Accepted

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

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

if b-1 <= n:
    x = b-1
    ans = math.floor(a*x/b) - a * math.floor(x/b)
else:
    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())
print((lambda x: int(A * x / B) - A * int(x / B))(min(B - 1, N)))

Submission status: Accepted

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

y = b-1
x = 0
if y < n:
  x = y
else:
  x = n
print(math.floor(a*x/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 sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline    ####
int1 = lambda x: 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)]

INF = float('inf')

from math import floor

def solve():
    a, b, n = MI()

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


if __name__ == '__main__':
    solve()

Submission status: Accepted

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

Submission status: Accepted

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

ans_N = (A * N) // B - A * (N // B)

X = min(N, B - 1)
ans_X = (A * X) // B - A * (X // B)

print(max(ans_N, ans_X))

Submission status: Accepted

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

tmp = min(B-1,N)

print(int(A*(tmp)/B) - A * int(tmp/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:
from __future__ import print_function

import sys
sys.setrecursionlimit(500000)

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return

# from fractions import gcd
# from math import gcd

# def lcm(n, m):
#     return int(n * m / gcd(n, m))


# def coprimize(p, q):
#     common = gcd(p, q)
#     return (p // common, q // common)


# def find_gcd(list_l):
#     x = reduce(gcd, list_l)
#     return x


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


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


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)

Submission status: Accepted

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

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

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

print(ans)

Submission status: Accepted

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

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

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


print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

A, B, N = (int(x) for x in input().split())
ans = math.floor(A * min(B-1, 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 = map(int, input().split())

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

Submission status: Accepted

Solution code:
from math import floor

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

x = min(B - 1, 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())
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:
"""
 floor(a/b) 
=(a-a%b)/b
上を利用して与えられた式を変形すると
max (A(x%B)-(Ax%B)) / B
ここで
Ax%B = A(x%B)%B
つまり、AxをBで割った余りは、xをBで割った余りにAをかけたものを、Bで割った余り
を利用すると
max (A(x%B)-A(x%B)%B) / B
つまりA(x%B)、さらに言えばx%Bを最大化すれば良い

x%Bを最大化するには
N>=B-1 のときは　x=B-1
N<B-1　のときは x=N
"""

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
A,B,N = [int(i) for i in readline().split()]

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

ans =0

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin python3
# -*- coding: utf-8 -*-

import sys
input = sys.stdin.readline

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



if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

main()

Submission status: Accepted

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

# D - Floor Function
a, b, n = map(int, input().split())

if n >= b:
	n = b - 1

print((a*n)//b)

Submission status: Accepted

Solution code:
import math

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun May  3 11:14:35 2020

@author: ab
"""
import math
import sys
input = sys.stdin
output = sys.stdout
while True:
    lineElements = input.readline().rstrip("/n").split(" ")
    if(lineElements[0] == ''):
        break;
    a,b,n = lineElements
    a,b,n = int(a),int(b),int(n)
    if n==1:
        x = 0
    elif n<b-1:
        x = n
    else:
        x = b-1
    result = math.floor((a*x)/b)-a*math.floor(x/b)
    print(str(result)+'\n')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from copy import deepcopy
from sys import exit,setrecursionlimit
import math
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac
import fractions
from functools import reduce
from operator import mul
import bisect
import sys
import logging
import heapq
import itertools

logging.basicConfig(level=logging.ERROR)

#input = sys.stdin.readline

setrecursionlimit(1000000)


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

main()

Submission status: Accepted

Solution code:
from math import floor

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

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

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

Submission status: Accepted

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

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


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

Submission status: Accepted

Solution code:
# coding:utf-8

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# x = p * b + q
# 0 <= q < b
# int(a * p + a * q / b) - a * int(p - q / b)
# = a * p + int(a * q / b) - a * p
# = int(a * q / b)

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

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

Submission status: Accepted

Solution code:
a=input().split()
A=int(a[0])
B=int(a[1])
N=int(a[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 = [int(_) for _ in input().split()]

from math import gcd, floor

g = A * B // gcd(A, B)
if N >= g:
    N = g

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

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

print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

bl=input().split()
A=int(bl[0])
B=int(bl[1])
C=int(bl[2])

if C<B:
  m=math.floor(A*C/B)-A*math.floor(C/B)
else:
  m=math.floor(A*(B-1)/B)

print(m)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
 
 
def solve(A: int, B: int, N: int):
    x = min(B - 1, N)
    print(A * x // B)
 
 
    return
 
 
# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    solve(A, B, N)
 
if __name__ == '__main__':
    main()

Submission status: Accepted

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

from math import floor

x = min(b-1, n)

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

Submission status: Accepted

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

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:
# -*- coding: utf-8 -*-


def main():
    from math import floor
    import sys
    input = sys.stdin.readline

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

    if n < b:
        print(floor(a * n / b))
    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())
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)
print(A * x // B - A * (x // B))

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import numpy as np
def main():
    A, B, N = map(int, input().split())
    max_value = 0
    x = np.min([B-1, N])
    max_value = int(np.floor(A*x/B))
    print(max_value)
    
if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,n=list(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())
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())

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import itertools#これは色々使える組み込み関数みたいなやつ
import fractions
import copy
import bisect
import math
import numpy as np

#import math#数学的計算はこれでいける。普通に0.5乗しても計算可能
#w=input()
from operator import itemgetter
from sys import stdin
#input = sys.stdin.readline#こっちの方が入力が早いが使える時に使っていこう
from operator import mul
from functools import reduce
from collections import Counter
#from collections import deque

#input = stdin.readline


j=0
k=0
n=3
r=1
a=[0]*5
b=[]
#n=int(input())
#r=int(input())
#print(M)
#A=int(input())
#B=int(input())
#print(N)
"1行1つの整数を入力を取得し、整数と取得する"


#number_list=list(map(int, input().split(" ")))#数字の時
#print(number_list)
"12 21 332 とか入力する時に使う"
"1行に複数の整数の入力を取得し、整数として扱う"

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
#メモ
for i in number_list:#こっちの方がrage使うより早いらしい
    print(number_list[i-1])#

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'''
x=[]
y=[]
for i in range(N):
    x1, y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)
print(x)
print(y)
"複数行に2数値を入力する形式 x座標とy座標を入力するイメージ"
'''

'''
mixlist=[]
for i in range(N):
    a,b=input().split()
    mixlist.append((int(a),b))
print(mixlist)
"複数行にintとstrを複合して入力するやつ，今回はリスト一つで処理している"
'''

'''
#array=[input().split()for i in range(N)]
#print(type(array[0][0]))
#print(array)
"正方行列にstr型の値を入力"
'''

#brray=[list(map(int, input().split(" ")))for i in range(N)]
#print(type(brray[0][0]))
#print(brray)
'''
入力
1 2
4 5
7 8
出力結果
[[1, 2], [4, 5], [7, 8]]
'''
"列数に関して自由度の高いint型の値を入力するタイプの行列"
#以下に別解を記載
#N, M = [int(i) for i in input().split()]
'''
table = [[int(i) for i in input().split()] for m in range(m)]

print(type(N))
print(N)
print(type(M))
print(M)

print(type(table))
print(table)
'''




#s=input()
#a=[int(i) for i in s]
#print(a[0])
#print([a])
#単数値．桁ごとに分割したい．入力と出力は以下の通り
#イメージとして1桁ごとにリストに値を入れているかんじ
#intを取ると文字列分解に使える
'''
入力
1234
出力
1
[[1, 2, 3, 4]]
'''




'''
word_list= input().split(" ")
print(word_list[0])
"連続文字列の入力"
"qw er ty とかの入力に使う"
"入力すると空白で区切ったところでlistの番号が与えられる"
'''



'''
A, B, C=stdin.readline().rstrip().split()#str style 何個でもいけることが多い
print(A)
"リストではなく独立したstr型を入れるなら以下のやり方でOK"
'''


#a= stdin.readline().rstrip()
#print(a.upper())
"aという変数に入っているものを大文字にして出力"


#a,b=map(int, input().split())  #int style 複数数値入力　「A B」みたいなスペース空いた入力のとき

#なんかうまく入力されるけど
#a=[[int(i) for i in 1.strip()]for 1 in sys.stdin]
#a = [[int(c) for c in l.strip()] for l in sys.stdin]]
#print(a)
#複数行の数値を入力して正方行列を作成


##############################################################################################
##############################################################################################
#under this line explains example calculation

'''
コンビネーションの組み合わせの中身を出力する形式
for i in itertools.combinations(brray, 2)
combinationsをpermutationsにすれば順列になる
今回なら(abc133B)
入力
1 2
5 5
-2 8
出力
[[1, 2], [5, 5], [-2, 8]]
もちろん一次元リストでも使えるし
何よりiもリストのように使えるので便利
'''

#nCr combination
'''
def cmb(n,r):
    #When n < r , this function isn't valid
    r= min(n-r,r)
    #print(n,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n-r, -1))
    #flochart mul(n,n-1)=x
    #next     mul(x,n-2)........(n-r+1,n-r)
    #mul read a,b and returns a*b

    under = reduce(mul, range(1, r+1))
    #print(over, under)
    #reduce is applied mul(1,2)=2
    #next   mul(2,3)=6
    #next   mul(6,4)=4.........last(r!,r+1)=r+1!

    return over // under
    #// is integer divide
    #calc example 5C2
    #over=5*4*3
    #under=3*2*1
a = cmb(n, r)
#print(a)
'''

'''
#集計
#example
#a=[2,2,2,3,4,3,1,2,1,3,1,2,1,2,2,1,2,1]
#a=Counter(a)
for i in a.most_common(n):print(i)
#most_common()メソッドは、出現回数が多い要素順にCounterオブジェクトを並び替えます。
#引数にint型の数字nを設定した場合は、出現回数が高い上位ｎ個の要素を返します。
#何も設定しなければ、コンテナ型にあるすべての要素を出現回数の順番に並び替えたタプル型オブジェクトを返します。
#out put
#(2, 8)
 #(1, 6)
#(3, 3)
#(4, 1)
'''


#二部探索(binary search)
#A = [1, 2, 3, 3, 3, 4, 4, 6, 6, 6, 6]
#print(A)
#index = bisect.bisect_left(A, 5) # 7 最も左(前)の挿入箇所が返ってきている
#A.insert(index, 5)
#print(index)
#print(A)
'''
bisect.bisect_left(a, x, lo=0, h=len(a))
引数
a: ソート済みリスト
x: 挿入したい値
lo: 探索範囲の下限
hi: 探索範囲の上限
(lo, hiはスライスと同様の指定方法)
bisect_leftはソートされたリストaに対して順序を保ったままxを挿入できる箇所を探索します。leftが示す通り、aにすでにxが存在している場合は、挿入箇所は既存のxよりも左側になります。また、lo, hiを指定することで探索範囲を絞り込むことも可能です。デフォルトはaの全体が探索対象です。
'''





########################################################################
########################################################################
#b2=a[:]  #1次元のときはコピーはこれで良い
#print(b2)

#a= [[0]*3 for i in range(5)] #2次元配列はこう準備、[[0]*3]*5だとだめ
#b3=copy.deepcopy(a)  #2次元配列はこうコピーする
#print(b3)


input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

'''
脳筋ゴリ押し蛮族中尾君に下る数学の鉄槌

f(x) = floor(Ax/B) − A × floor(x/B) とします。
f(x + B) = f(x) であることは実際に代入することで容易に分かります。なので、0 ≤ x ≤ B − 1
の場合のみを考えます。
このとき、f(x) = floor(Ax/B) − A × floor(x/B) = floor(Ax/B) で、floor(Ax/B) は広義単
調増加なので、与えられた制約 (0 ≤ x ≤ B − 1, 0 ≤ x ≤ N) の中で最も大きい x について、f(x)
が求める最大値です。
よって、答えは f(min(B − 1, N)) です
'''

def main():
    A, B, N = map(int, input().split())#値の読み取り
    x=min(B-1,N)
    k=((A*x)//B)-A*(x//B)
    print(k)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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())
x = min(B-1, N)
ans = math.floor(A * (x % B) / 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) - A*int(x/B)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
import math

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

ans_x = min(N, B - 1)
ans = math.floor(A * ans_x / B) - A * math.floor(ans_x / B)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


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

if __name__ == '__main__':
    def solve(a, b, x):
        return math.floor(a * x / b) - a * math.floor(x / b)


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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import math
A, B, N = list(map(int, input().split()))
if B-1 >= N:
  num = N
else:
  num = B-1
  
print(math.floor(A*num/B)-A*math.floor(num/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:
#!/usr/bin/python3
import math

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


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

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