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: Wrong Answer

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


N=3
M=3
i=0
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)
pre=0
"1行1つの整数を入力を取得し、整数と取得する"
A,B,N=map(int, input().split(" "))
for i in range(N+1):
    k=((A*i)//B)-A*(i//B)
    #print(pre,k)
    if pre > k:
        #print(pre)
        sys.exit()
    pre=k
    b.append(k)
    k=0
print(max(b))
#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)

Submission status: Wrong Answer

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

if n<=b:
  qlist = range(n+1)
else:
  qlist = range(b)
  
anslist = list(map(lambda x:a*x//b,qlist))

print(max(anslist))

Submission status: Wrong Answer

Solution code:
A,B,N = map(int, input().split())
ans = -1
for t in range(N+1):
    x = t 
    ansX = A*x//B-A*(x//B)
    if ansX > ans:
        ans = ansX
    elif ansX == ans:
        break

print(ans)

Submission status: Wrong Answer

Solution code:
#import matplotlib.pyplot as plt

def main():
    a,b,n = map(int,input().split())
    mx = 0
    for x in range(1,min(a+1,n+1)):
        left = int(a*x/b)
        right = a * int(x/b)
        #print("x=",x,"floor(Ax/B)=",int(a*x//b),"A*floor(x/B)=",a * int(x // b),"answer=",left-right)
        #right.append(a * int(x/b))

        mx = max(left-right,mx)
    print(mx)


    #plt.plot(list(range(len(right))),right,label="test")


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
a, b , n = map(int, input().split())
def floor_abx(a, b, x):
    return int(a*x/b) - int(x/b)*a 
    
res = 0
for i in range(n+1-a, n+1):
    num = floor_abx(a, b, i)
    if res < num:
        res = num
for i in range(1, a):
    num = floor_abx(a, b, i)
    if res < num:
        res = num
print(res)

Submission status: Wrong Answer

Solution code:
import math
 
A,B,N=map(int,input().split())
z=-float('inf')
 
for x in range(1,N+1):
  y=math.floor((A*x)/B)+A*math.floor(x/B)
  z=max(z,y)
  
print(z)

Submission status: Wrong Answer

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

def calc(x):
    # print(a, b, x)
    return (a*x)//b - a*(x//b)

res = 0

for i in range(1, min(a + 1, n + 1)):
    # print(i)
    res = max(res, calc(i))
    # print(res)

print(res)

Submission status: Wrong Answer

Solution code:
A,B,N = map(int, input().split())
ans = -1145141919810931931
Flag = True
for x in range(1, N+1, max(1, int(B/A) - 1)):
    a = int(A*x/B) - A*int(x/B)
    if a>ans:
        ans = a
        Flag = True
    elif Flag:
        Flag = False
    else:
        break

a = int(A*N/B) - A*int(N/B)
if a>ans:
    ans = a
print(ans)

Submission status: Wrong Answer

Solution code:
import math
abn = list(map(int, input().split()))
a = abn[0]
b = abn[1]
n = abn[2]
ans = 0
for x in range(n + 1):
  val: int = math.floor(a * x / b) - a * math.floor(x / b)
  if val > ans:
    ans = val
print(val)

Submission status: Wrong Answer

Solution code:
A, B, N = map(int, input().split())
max = 0
wait = int(B/A) + 1
for x in range(1, N+1, wait):
    fun = int(A*x/B) - A*int(x/B)
    if x == 1:
        x0 = fun
    elif x > wait:
        if x0 == fun:
            break
    if max < fun:
        max = fun
print(max)

Submission status: Wrong Answer

Solution code:
A,B,N = map(int,input().split())
lst = []
for i in range(N-1,N+1):
    c = int(A*i/B) - A * int(i/B)
    lst.append(c)
print(max(lst))

Submission status: Wrong Answer

Solution code:
import math
a,b,c=map(int,input().split())
max=0
for i in range(c+1):
    d=math.floor(a*i/b)-a*math.floor(i/b)
    if max<d:
        max=d
print(c)


'''

for i in list1:

    if lv[i[1]-1]-lv[i[0]-1]==i[2]:
        #print(lv)
        #print(i)
        sum1+=i[3]


if max<=sum1:
    max=sum1




print(max)
'''

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline
from collections import defaultdict
from heapq import heappop, heappush

from decimal import *

##### リストの 二分木検索 #####
# bisect_left(lists, 3)
# bisect_right(lists, 3)

##### プライオリティキュー #####
# heapq.heapify(a) #リストaのheap化
# heapq.heappush(a,x) #heap化されたリストaに要素xを追加
# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力

# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう
# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと

##### タプルリストのソート #####
# sorted(ans) #(a, b) -> 1st : aの昇順, 2nd : bの昇順
# sorted(SP, key=lambda x:(x[0],-x[1])) #(a, b) -> 1st : aの昇順, 2nd : bの降順
# sorted(SP, key=lambda x:(-x[0],x[1])) #(a, b) -> 1st : aの降順, 2nd : bの昇順
# sorted(SP, key=lambda x:(-x[0],-x[1])) #(a, b) -> 1st : aの降順, 2nd : bの降順

# sorted(SP, key=lambda x:(x[1])) #(a, b) -> 1st : bの昇順
# sorted(SP, key=lambda x:(-x[1])) #(a, b) -> 1st : bの降順

##### 累乗 #####
# pow(x, y, z) -> x**y % z

##### 割り算の切り上げ #####
# tmp = -(-4 // 3)

##### dict の for文 #####
# for k, v in d.items():
#     print(k, v)

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
def inputStr(): return input()[:-1]

inf = float('inf')
mod = 1000000007

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

def main():
	A,B,N = inputMap()

	maxs = 0
	conts = 2000000
	for x in range(N,0,-1):
		tmp = math.floor(A * x / B) - A * math.floor(x / B)
		conts -= 1
		if maxs < tmp:
			maxs = tmp
		if conts == 0:
			break

	conts = 10000000
	for x in range(0,N):
		tmp = math.floor(A * x / B) - A * math.floor(x / B)
		conts -= 1
		if maxs < tmp:
			maxs = tmp
		if conts == 0:
			break

	print(maxs)



#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
# nCr mod m
# rがn/2に近いと非常に重くなる
def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res

# mを法とするaの乗法的逆元
def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

def egcd(a, b):
    if a == 0:
        return b, 0, 1
    else:
        g, y, x = egcd(b % a, a)
        return g, x - (b // a) * y, y

# nHr mod m
# 問題によって、combination()を切り替えること
def H(n, r, mod=10**9+7):
	# comb = Combination(n+r-1, mod)
	# return comb(n+r-1, r)
    return combination(n+r-1, r, mod)


class Combination:
    """
    O(n)の前計算を1回行うことで，O(1)でnCr mod mを求められる
    n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
    使用例：
    comb = Combination(1000000)
    print(comb(5, 3))  # 10
    """
    def __init__(self, n_max, mod=10**9+7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]
        facinv = [1]
        for i in range(1, n+1):
            fac.append(fac[i-1] * i % self.mod)
            facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n+1)
        modinv[1] = 1
        for i in range(2, n+1):
            modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
        return modinv

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
# dfs のサンプル
def dfs(graph,parent,counter,edge):
    stk = []
    stk.append(edge)
    while len(stk) > 0:
        p = stk.pop()
        for e in graph[p]:
            if parent[p] == e:
                continue
            else:
                parent[e] = p
                counter[e] += counter[p]
                stk.append(e)

if __name__ == "__main__":
	main()

Submission status: Wrong Answer

Solution code:
A,B,N=map(int,input().split())
t=A*N//B
if N<B:
  a=A*N//B
else:
  l=[(A*x)//B-A*(x//B) for x in range(B,N+1)]
  if t>=max(l):
    a=t
  else:
    a=max(l)
print(a)

Submission status: Wrong Answer

Solution code:
import math
A,B,N = map(int,input().split())
maxn =0
if A<B:
    if B/2 <N:
        t = math.ceil(B/2)
        ans = math.floor((A*t)/B)-A*(math.floor(t/B))
    else:
        ans = math.floor((A*N)/B)-A*(math.floor(N/B))
else:
    for x in range(1,B+1):
        tmp = math.floor((A*x)/B)-A*(math.floor(x/B))
        if maxn < tmp:
            maxn = tmp
    ans =maxn
print(ans)

Submission status: Wrong Answer

Solution code:
from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    from math import floor
    a,b,n = readInts()

    p = b-1 if b-1 <= n else n-1
    #print(p)
    if a != b != 1 and n == 1:
        print(floor(a*1//b) - a*floor(1//b))
        exit()
    print(floor(a*p//b) - a*floor(p//b))


if __name__ == '__main__':
  main()

Submission status: Wrong Answer

Solution code:
import math

def siki(A, B, X):
	return math.floor((A*X)/B) - A*math.floor(X/B)

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

for i in range(1, B+1):
	if max_value < siki(A,B,i):
		max_value = siki(A,B,i)
	print(max_value)
print(max_value)

Submission status: Wrong Answer

Solution code:
import math
A,B,N=list(map(int,input().split()))
maxi = min(A,N)
ans = 0
for i in range(1,maxi+1):
    ans = max(ans,math.floor((A*i)/B)-A*math.floor(i/B))
print(ans)

Submission status: Wrong Answer

Solution code:
a, b, n = map(int, input().split())
max_int = 0
if a != b:
    for i in range(n, n-max(int(b/a), int(a/b)), -1):
        tmp = int((a*i)/b) -a * int(i/b)
        #print(tmp)
        if max_int < tmp:
            max_int = tmp

print(max_int)

Submission status: Wrong Answer

Solution code:
from math import floor

a, b, n = [int(x) for x in input().split()]
result = []

for x in range(n-2, n+1):
    value = floor(a*x/b) - a * floor(x/b)
    result.append(value)

print(max(result))

Submission status: Wrong Answer

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

if N < B:
    print((A*N)//B)
elif N == B:
    NN = N-1
    print((A*NN)//B)
else:
    if N < 2*B:
        sahen = (N*A)//B
        uhen = A
        print(sahen - uhen)
    else:
        wN = N % B
        wwN = B * wN -1
        sahen1 = (A*wwN)//B
        uhen1 = A * (wwN//B)
        kouho1 = sahen1 - uhen1
        
        sahen2 = (A*N)//B
        uhen2 = A * (N//B)
        kouho2 = sahen2 - uhen2
        print(max(kouho1,kouho2))

Submission status: Wrong Answer

Solution code:
import math

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

cal = math.floor(A*(N-1)/10) - A * math.floor((N-1)/B)
print(math.floor(cal))

Submission status: Wrong Answer

Solution code:
import sys
import itertools
if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
a,b,n=map(int,input().split())
cnt=0

if n//b>0:
	print(a*(b-1)//b-a*((b-1)//b))
else:
	for i in range(n):
		cnt=max(cnt,(a*(i)//b-a*((i)//b)))
	print(cnt)

Submission status: Wrong Answer

Solution code:
def resolve():
    '''
    code here
    '''
    A,B,N = [int(item) for item in input().split()]

    def func(x):
        first = int(A * x / B)
        second = A * int(x/B)
        return first - second

    if A == 1 or B == 1:
        print(0)
    elif B > 1:
        if B < N:
            print(A-1)
        else:
            print(func(N))


if __name__ == "__main__":
    resolve()

Submission status: Wrong Answer

Solution code:
import math

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

left, right = 0, n
while right > left + 10:
    mid1 = (right * 2 + left) // 3 + 1
    mid2 = (right + left * 2) // 3
    if f(mid1) <= f(mid2):
        # 上限を下げる（最小値をとるxはもうちょい下めの数だな）
        right = mid2
    else:
        # 下限を上げる（最小値をとるxはもうちょい上めの数だな）
        left = mid1
listalt = []
for i in range(max(0, left - 100), min(right + 100, n)):
    listalt.append(f(i))
listalt.append(f(0))
listalt.append(f(n))
print(max(listalt))

Submission status: Wrong Answer

Solution code:
import math
a, b, n = map(int, input().split())
x= int((1-a)/b)
list = []
while x < n:
    t1 = int(math.floor((a*x)/b))
    t2 = int(a * math.floor(x/b))
    t3 = t1 - t2
    x+=1

    list.append(t3)
print(max(list))

Submission status: Wrong Answer

Solution code:
a, b, n = map(int, input().split())
if n < b:
    print((a*n)//b)
else:
    ans = -1
    cnt = 0
    for x in range(b//a, n):
        tmp = (a*x)//b - a*(x//b)
        if tmp > ans:
            ans = tmp
        elif tmp < ans or cnt > b:
            break
        if tmp == 0:
          cnt += 1
    print(ans)

Submission status: Wrong Answer

Solution code:
import math
A,B,n=map(int,input().split())
sum=0
x=n
while 1:
	ans=math.floor(A*x/B)-A*math.floor(x/B)
	if sum<ans:
		sum=ans
	else:
		break
print(sum,end="")

Submission status: Wrong Answer

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

    A_ans = 0
    for i in range(min(N, B), 1, -A):
        tmp = (A * i // B) - A * (i // B)
        A_ans = max(tmp, A_ans)

    B_ans = 0
    for j in range(min(N, B), 1, -B):
        tmp = (A * j // B) - A * (j // B)
        B_ans = max(tmp, B_ans)
    
    print(max(B_ans, A_ans))


resolve()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#coding:utf-8

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

z = 0
x = n / b

if n < b:
    z = int(a * x) - a * int(x)
else:
    z = a - 1

print("{}".format(z))

Submission status: Wrong Answer

Solution code:
import math
a,b,c=map(int,input().split())
max=0
for i in range(c+1):
    d=math.floor(a*i/b)-a*math.floor(i/b)
    if max<c:
        max=c
print(c)

Submission status: Wrong Answer

Solution code:
"""
import math

M,N,Q = map(int,input().split())
a = []

for i in range(Q):
    a.append(list(map(int,input().split())))

print(a)
"""

import math

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

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

if N%B!=0:
    ans=math.floor(A*N/B)-A*math.floor(N/B)
else:
    ans=math.floor(A*(N-1)/B)-A*math.floor((N-1)/B)

print(max(q,ans))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import math
from collections import deque
a, b, n = map(int, input().split())
d = deque(list(math.floor(a*i/b)- a * math.floor(i/b) for i in range(1, min(n+1, 50000))))
print(max(d))

Submission status: Wrong Answer

Solution code:
import sys
import math
import bisect

# import copy
# import heapq
# from collections import deque
# import decimal

# sys.setrecursionlimit(100001)
INF = sys.maxsize
MOD = 10 ** 9 + 7

# ===CODE===

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

left = 1
right = n

ans = 0
num = 0
while abs(left - right) > 10**(-4):
    tmp_left = left + (right - left) / 3
    tmp_right = left + 2 * (right - left) / 3

    c_left = math.floor(a * left / b) - a * math.floor(left / b)
    c_right = math.floor(a * right / b) - a * math.floor(right / b)

    f_left = math.floor(a * tmp_left / b) - a * math.floor(tmp_left / b)
    f_right = math.floor(a * tmp_right / b) - a * math.floor(tmp_right / b)

    if c_left < f_left < f_right:
        left = tmp_left
        if ans < f_left:
            ans = f_left
            num = tmp_left
    else:
        right = tmp_right
        if ans < f_right:
            ans = f_right
            num = tmp_right


ans1 = math.floor(a * int(num) / b) - a * math.floor(int(num) / b)
ans2 = math.floor(a * int(num+1) / b) - a * math.floor(int(num+1) / b)

print(int(max(ans1,ans2)))

Submission status: Wrong Answer

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

import math

cnt = 0
box = [0]
for x in reversed(range(1, n+1)):
  floor = math.floor(a*x/b) - a*math.floor(x/b)
  box.append(floor)
  cnt+=1
  if cnt == b+1:
    break

box.sort(reverse=True)
print(box[0])

Submission status: Wrong Answer

Solution code:
import math

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

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce
from operator import mul


sys.setrecursionlimit(2147483647)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
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)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


a, b, n = LI()
ans = -INF
if b < 10 ** 6:
    for x in range(b):
        if x > n:
            break
        ans = max(ans, a * x // b - a * (x // b))
elif b - 1 > n:
    ans = n
else:
    x = b - 1
    while True:
        ans = max(ans, a * x // b - a * (x // b))
        x += b
        if x > n:
            break

print(ans)

Submission status: Wrong Answer

Solution code:
import math
A, B, N = map(int, input().split())
lists = []
for x in range(0, N+1):
    result = math.floor(A * x / B) - A * (math.floor(x/B))
    lists.append(result)
print(lists[-1])

Submission status: Wrong Answer

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

ans = None
a_max = None

for _x in range(N):
    x = _x + 1
    a = x/B-int(x / B)
    # print(int(a * A))
    sa = int(a*A)
    # s = int((A * x) / B) - A * int(x / B)
    if a_max == None:
        a_max = sa
    elif sa > a_max:
        a_max = sa

print(sa)

Submission status: Wrong Answer

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

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

else:
    print(max(int(A*N/B) - A*int(N/B), int(A*(N-1)/B) - A*int((N-1)/B), int(A*(B-1)/B) - A*int((B-1)/B)))
    exit()

Submission status: Wrong Answer

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

aaa = math.floor(A * N / B) - A * math.floor(N / B)

v = N % B
v += 1
bbb = 0
if N - v >= 0:
    bbb = math.floor(A * (N - v) / B) - A * math.floor((N - v)/ B)
ccc = 0
if B - 1 >= 0:
    ccc = math.floor(A * min((B - 1), N) / B)

print(max(aaa, bbb, ccc))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline
from collections import defaultdict
from heapq import heappop, heappush

from decimal import *

##### リストの 二分木検索 #####
# bisect_left(lists, 3)
# bisect_right(lists, 3)

##### プライオリティキュー #####
# heapq.heapify(a) #リストaのheap化
# heapq.heappush(a,x) #heap化されたリストaに要素xを追加
# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力

# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう
# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと

##### タプルリストのソート #####
# sorted(ans) #(a, b) -> 1st : aの昇順, 2nd : bの昇順
# sorted(SP, key=lambda x:(x[0],-x[1])) #(a, b) -> 1st : aの昇順, 2nd : bの降順
# sorted(SP, key=lambda x:(-x[0],x[1])) #(a, b) -> 1st : aの降順, 2nd : bの昇順
# sorted(SP, key=lambda x:(-x[0],-x[1])) #(a, b) -> 1st : aの降順, 2nd : bの降順

# sorted(SP, key=lambda x:(x[1])) #(a, b) -> 1st : bの昇順
# sorted(SP, key=lambda x:(-x[1])) #(a, b) -> 1st : bの降順

##### 累乗 #####
# pow(x, y, z) -> x**y % z

##### 割り算の切り上げ #####
# tmp = -(-4 // 3)

##### dict の for文 #####
# for k, v in d.items():
#     print(k, v)

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
def inputStr(): return input()[:-1]

inf = float('inf')
mod = 1000000007

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

def main():
	A,B,N = inputMap()

	maxs = 0
	conts = 6000000
	for x in range(N,0,-1):
		tmp = math.floor(A * x / B) - A * math.floor(x / B)
		conts -= 1
		if maxs < tmp:
			maxs = tmp
		if conts == 0:
			break



	print(maxs)



#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
# nCr mod m
# rがn/2に近いと非常に重くなる
def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res

# mを法とするaの乗法的逆元
def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

def egcd(a, b):
    if a == 0:
        return b, 0, 1
    else:
        g, y, x = egcd(b % a, a)
        return g, x - (b // a) * y, y

# nHr mod m
# 問題によって、combination()を切り替えること
def H(n, r, mod=10**9+7):
	# comb = Combination(n+r-1, mod)
	# return comb(n+r-1, r)
    return combination(n+r-1, r, mod)


class Combination:
    """
    O(n)の前計算を1回行うことで，O(1)でnCr mod mを求められる
    n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
    使用例：
    comb = Combination(1000000)
    print(comb(5, 3))  # 10
    """
    def __init__(self, n_max, mod=10**9+7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]
        facinv = [1]
        for i in range(1, n+1):
            fac.append(fac[i-1] * i % self.mod)
            facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n+1)
        modinv[1] = 1
        for i in range(2, n+1):
            modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
        return modinv

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
# dfs のサンプル
def dfs(graph,parent,counter,edge):
    stk = []
    stk.append(edge)
    while len(stk) > 0:
        p = stk.pop()
        for e in graph[p]:
            if parent[p] == e:
                continue
            else:
                parent[e] = p
                counter[e] += counter[p]
                stk.append(e)

if __name__ == "__main__":
	main()

Submission status: Wrong Answer

Solution code:
import math

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

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

Submission status: Wrong Answer

Solution code:
A,B,N = list(map(int,input().split()))
if N <= 10000:
    C = [A*i//B-(A*(i//B)) for i in range(1,N+1)]
    print(max(C))
    exit()
C = [A*i//B-(A*(i//B)) for i in range(10000)]
D = [A*i//B-(A*(i//B)) for i in range(N,N-10000,-1)]
E = [A*i//B-(A*(i//B)) for i in range(N//2-10000,N//2+10000)]
print(max(max(C),max(D),max(E)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
 
A, B, N = map(int, input().split())
list1 = []
for x in range(N-1, N+1):
     list1.append(math.floor(A*x/B) - (A * math.floor(x/B)))
  
print(max(list1))

Submission status: Wrong Answer

Solution code:
a, b , n= input().split() 
a = int(a)
b = int(b)
n = int(n)
if b >= n :
    print(a*n//b)
else:
    max = 0
    for i in range(1,b,1):
        r = (a*i // b) - a* (i//b)
        if r > max:
            max = r

    print(max)

Submission status: Wrong Answer

Solution code:
#########行列読み込み ##############################################
"""
from sys import stdin
n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
print(data)
print(*data, sep='\n')
"""
##################################################################
#########入力系####################################################
"""
s =input()
s=list(input())
a=int(input())
x,y = map(int,input().split())	
li = input().split()	
li = list(map(int,input().split()))	
li = input().split('T')	
"""
##################################################################

#########行列読み込み ##############################################
"""
from sys import stdin
n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
print(data)
print(*data, sep='\n')
"""
##################################################################
#########入力系####################################################
"""
s =input()
s=list(input())
a=int(input())
x,y = map(int,input().split())	
li = input().split()	
li = list(map(int,input().split()))	
li = input().split('T')	
"""
##################################################################
import math
A,B,N = map(int,input().split())
#left = math.floor(A/B)

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