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:

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

Submission status: Wrong Answer

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

yuka = lambda a,b: (a-(a%b))//b

c = yuka(a,b)
'''
for x in range(b):
  score = (x%b)*c
  ans = max(ans,score)
'''
ans = (b-1)*c
print(ans)

Submission status: Wrong Answer

Solution code:
import math

a,b,n = map(int, input().split())
ans = 0
if a<10:
  N = [x for x in range(1,n+1) if a*(x/b - int(x/b))>1]
else:
  N = [n]

for x in N:
  k = x/b
  f = math.floor(a*k) - math.floor(k)*a
  if ans<f:
    ans = f

print(ans)

Submission status: Wrong Answer

Solution code:
import math

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

x = 1
k = 1/b
f = math.floor(a*k) - math.floor(k)*a
ans = 0
N = [x for x in range(1,n+1) if a*(x/b - int(x/b))>1]

for x in N:
  if ans<f:
    ans = f
  k = x/b
  f = math.floor(a*k) - math.floor(k)*a
  
print(ans)

Submission status: Wrong Answer

Solution code:
a,b,n=map(int,input().split())
c=-9999999
for i in range(1,min(b,n)):
  k=(int(a*i)/b)-(a*(int(i/b)))
  if int(k)>c:
    c=int(k)
print(c)

Submission status: Wrong Answer

Solution code:
a,b,n=map(int,input().split())
c=-9999999
for i in range(1,b):
  k=(int(a*i)/b)-(a*(int(i/b)))
  if int(k)>c:
    c=int(k)
print(c)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

print(A*N // B)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

ans=0
for x in range(A*3):
  #print(A//B,x//B,A*x//B,A*x//B-A*(x//B))
  ans=max(ans,A*x//B-A*(x//B))
print(ans)

Submission status: Wrong Answer

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

ans=0
for x in range(A):
  #print(A//B,x//B,A*x//B,A*x//B-A*(x//B))
  ans=max(ans,A*x//B-A*(x//B))
print(ans)

Submission status: Wrong Answer

Solution code:
import math

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

low = 0
high = N

while low <= high:
    mid = (low + high) // 2
    if (math.floor((A * mid) / B) - A * math.floor(mid / B)) > (math.floor((A * (mid + 1)) / B) - A * math.floor((mid + 1) / B)):
        high = mid - 1
    elif (math.floor((A * mid) / B) - A * math.floor(mid / B)) < (math.floor((A * (mid + 1)) / B) - A * math.floor((mid + 1) / B)):
        low = mid + 1
    else:
        break

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

g = gcd(A, B)
b = B // g

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math

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

Submission status: Wrong Answer

Solution code:
import math

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

Submission status: Wrong Answer

Solution code:
import math

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

Submission status: Wrong Answer

Solution code:
import math

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

Submission status: Wrong Answer

Solution code:

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

def func(t):
    return int(t)

syo=N//B
amari=N%B

if syo==0:
    x=amari
    print(func(A*x/B)-A*func(x/B))
else:
    x1=B-1
    x2=N
    ans1=func(A*x1/B)-A*func(x1/B)
    ans2=func(A*x2/B)-A*func(x2/B)
    print(max(ans1,ans2))

Submission status: Wrong Answer

Solution code:

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

def func(t):
    return int(t)

syo=N//B
amari=N%B

if syo==0:
    x=amari
    print(func(A*x/B)-A*func(x/B))
else:
    x1=syo*B-1
    x2=N
    ans1=func(A*x1/B)-A*func(x1/B)
    ans2=func(A*x2/B)-A*func(x2/B)
    print(max(ans1,ans2))

Submission status: Wrong Answer

Solution code:

A,B,N=map(int,input().split())
def func(t):
    return int(t)

syo=N//B
amari=N%B
if syo==0:
    x=amari
else:
    x=syo*B-1
print(func(A*x/B)-A*func(x/B))

Submission status: Wrong Answer

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


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

    print(max(aa, bb))

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

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


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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(int(A * N / B) - A * int(N/B))

Submission status: Wrong Answer

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

print(max(int(A * i / B) - int(i/B) for i in range(1,N+1)))

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
import sys

A,B,N = (int(a) for a in input().split())
ans = []
for i in range(1,N+1) :
    x = (A*i)//B - A * (i//B)
    if x not in ans :
        ans.append(x)
    elif A * i // B >= 1 :
        print(max(ans))
        sys.exit()
print(max(ans))

Submission status: Wrong Answer

Solution code:
import math
a,b, x = map(int, input().split())
if x%b == 0:
    print(math.floor((a*(x-1))/b) - a*math.floor((x-1)/b))
if x < b and x%b !=0:
    print(math.floor(a*x/b)-a*math.floor(x/b))
if x > b and x%b != 0:
    print(math.floor(a*(b-1)/b)-a*math.floor((b-1)/b))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#165D
#Floor Function

def floor(x):
    return x//1

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

if b==1:
    print(0)
    exit()
elif n%b==0:
    x=n-1
else:
    x=n
print(int(floor(a*x/b)-a*floor(x/b)))

Submission status: Wrong Answer

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

M = 0
for x in range(N-100, N+1):
    s = A * x // B - A * (x // B)
    if s > M:
        M = s
    # print(f"n={x} : {s}")
print(M)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A,B,N= map(int,input().split())
max_num = 0
N = N%B
for x in range(N,0,-1):
    n = int((A*x)/B)-(A*int(x/B))
    max_num = max(max_num,n)
print(max_num)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for x in range(1, N+1):
    temp_fl = - ((A*x)%B)/B + A*((x%B)/B)
    if temp_fl > ans_fl:
        ans_fl = temp_fl
        
print(ans_fl)

Submission status: Wrong Answer

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

for x in range(1, N+1):
    temp_fl = - ((A*x)%B)/B + A*((x%B)/B)
    print(x, ":", temp_fl)
    if temp_fl > ans_fl:
        ans_fl = temp_fl
        
print(ans_fl)

Submission status: Wrong Answer

Solution code:
A, B, N = map(int, input().split())
from math import floor
mans = -10e9
x = N
cand = floor(A*x/B) - A * floor(x/B)
print(cand)

Submission status: Wrong Answer

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


x = max(0,n-a-a-a-a)

s = -a

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


print(s)

Submission status: Wrong Answer

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


x = max(0,n-a-a-a-a)

s = -a

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

print(s)

Submission status: Wrong Answer

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

ans = 0
import math
for i in range(B-1,N+1):
    cnt = math.floor(A*i/B) - A *math.floor(i/B)
    ans = max(cnt,ans)
print(ans)

Submission status: Wrong Answer

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

ans = 0
import math
for i in range(N+1):
    cnt = math.floor(A*i/B) - A *math.floor((B-1)/B)
    ans = max(cnt,ans)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from math import floor, ceil

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

#n以下で最大のbの倍数
num1= n-n%b-1
num2= n-n%b
num3= n-n%b+1

print(max(floor(a*n/b) - a*floor(n/b), floor(a*num1/b) - a*floor(num1/b), floor(a*num2/b) - a*floor(num2/b), floor(a*num3/b) - a*floor(num3/b)))

Submission status: Wrong Answer

Solution code:
from math import floor, ceil

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

#n以下で最大のbの倍数
num1= n-n%b-1
num2= n-n%b

print(max(floor(a*n/b) - a*floor(n/b), floor(a*num1/b) - a*floor(num1/b), floor(a*num2/b) - a*floor(num2/b)))

Submission status: Wrong Answer

Solution code:
from math import floor, ceil

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

#n以下で最大のbの倍数
num = n-n%b-1

print(max(floor(a*n/b) - a*floor(n/b), floor(a*num/b) - a*floor(num/b)))

Submission status: Wrong Answer

Solution code:
import math

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

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

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

Submission status: Wrong Answer

Solution code:
from math import floor, ceil

a, b, n = map(int, input().split())
# a, b, n = 10000, 100, 100000

#n以下で最大のbの倍数
num = n-n%b

print(max(floor(a*n/b) - a*floor(n/b), floor(a*num/b) - a*floor(num/b)))

Submission status: Wrong Answer

Solution code:
from math import floor, ceil

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


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

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

Submission status: Wrong Answer

Solution code:
from math import floor

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

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
a, b, n = map(int, input().split())
ans = -a
for x in range(0, n):
  func = math.floor(a * x / b) - a * math.floor(x / b)
  if ans < func:
    ans = func
    
print(ans)

Submission status: Wrong Answer

Solution code:
import math
a, b, n = map(int, input().split())
ans = 0
for x in range(0, n):
  func = math.floor(a * x / b) - a * math.floor(x / b)
  if ans < func:
    ans = func
    
print(ans)

Submission status: Wrong Answer

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

if(f(a,b,b-1)>0):
    print(f(a,b,b-1))
else:
    print(0)

Submission status: Wrong Answer

Solution code:
import math
import collections
def f(a,b,x):
    return math.floor((a*x)/b) - a*math.floor(x/b)
a,b,n=map(int, input().split())
dd = collections.defaultdict(int)
for i in range(n):
    k = f(a,b,i)
    if(dd[k]==0):
        dd[k]+=1
    print(k)
if(f(a,b,b-1)>0):
    print(f(a,b,b-1))
else:
    print(0)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

def main(a,b,n):
    m=min(a,n)
    maxdif=0
    for x in range(1,m+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: Wrong Answer

Solution code:
a, b, n = map(int, input().split())
list=[]
for x in range(n+1):
  q=x%b
  r=int(a*q)
  list.append(r)
print(max(list))

Submission status: Wrong Answer

Solution code:
from decimal import Decimal

def main():
    a, b, n = list(map(int, input().split()))
    
    floor_list = []
    
    for i in range(n+1):
        floor_1 = int(Decimal(a*i/b))
        floor_2 = a * int(Decimal(i/b))
        floor_list.append(floor_1 - floor_2)
    
    #print(floor_list)
    #floor_list.sort()
    print(floor_list[-1])
    #print(max(floor_list))

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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:
    if b != 1:
        x = b-1
    else:
        x = 1

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

Submission status: Wrong Answer

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

Solution code:
a,b,n = map(int, input().split())
l = []
for x in range(1,n+1):
    l.append(int(a*x/b)-a*int(x/b))
    if len(l) >= 2 and l[-1] == l[0]: break
if len(l) == 1:print(l[0])
else:print(max(l))

Submission status: Wrong Answer

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

def apple(s):
    return int((a/b)*s) - a*int(s/b)

ans = 0
i = 0
j = n
for _ in range(1000):
    if apple(i) > apple(j):
        j = int(j-((j-i)/2))+1
    elif apple(i) < apple(j):
        i = int(i+((j-i)/2))-1
    else:
        print(apple(i))
        break

Submission status: Wrong Answer

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

def apple(s):
    return int((a/b)*s) - a*int(s/b)

ans = 0
i = 0
j = n
for i in range(1000):
    if apple(i) > apple(j):
        j = int(j-((j-i)/2))+1
    elif apple(i) < apple(j):
        i = int(i+((j-i)/2))-1
    else:
        print(apple(i))
        break

Submission status: Wrong Answer

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

def apple(s):
    return int((a/b)*s) - a*int(s/b)

ans = 0
i = 0
j = n
for i in range(1000):
    if apple(i) > apple(j):
        j = int(j-(j-i)/2)+1
    elif apple(i) < apple(j):
        i = int(i+(j-i)/2)-1
    else:
        print(apple(i))
        break

Submission status: Wrong Answer

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,n)
    print(math.floor(a*x/b)-a*math.floor(x/b))
    return

if __name__=='__main__':
    Main()

Submission status: Wrong Answer

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

# x=0の場合、値は0
ans = 0
# x=1～Nについて
for x in range(1, B+1):
    if (A*x)//B - A*(x//B) > ans:
        ans = (A*x)//B - A*(x//B)
        
print(ans)

Submission status: Wrong Answer

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

def floor(x):
  return int(x)

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

Submission status: Wrong Answer

Solution code:
import math

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


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

Submission status: Wrong Answer

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

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

print(max)

Submission status: Wrong Answer

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

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

print(max)

Submission status: Wrong Answer

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

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

print(max)

Submission status: Wrong Answer

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

max = num = int(a*n/b) - a * int(n/b)

for x in range(((n+1)//b)*b, n+1, b):
    num = int(a*(x-1)/b) - a * int((x-1)/b)
    if num > max:
        max = num

print(max)

Submission status: Wrong Answer

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

max = num = int(a*n/b) - a * int(n/b)

for x in range(0, n+1, b):
    num = int(a*x/b) - a * int(x/b)
    if num > max:
        max = num

print(max)

Submission status: Wrong Answer

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

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

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

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


def main():
    
    ans = 0
    i = 0
    while B > i and i <= N:
        fi = f(i)
        ans = f(i) if ans < fi else ans
        i += 1 
    
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
# D - Floor Function
A,B,N = map(int,input().split())
x = max(B-1,N)
print(int(A*x/B))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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 A*B !=1 else print(0)
if __name__=='__main__':main()

Submission status: Wrong Answer

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 __name__=='__main__':main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

result = 1
for i in range(1, N + 1):
    result_new = math.floor(A * i / B) - A * math.floor(i / B)
    if result_new > result:
        result = result_new

print(result)

Submission status: Wrong Answer

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

Solution code:
# N>=x>=0
# return max(floor(A*x/B)-A*floor(x/B))
# floor(t) は実数t以下の最大の整数
# x = Nの時が最大
A, B, N = [int(i) for i in input().split()]
x = N
y = (A * x)// B - A * (x//B)
print(y)

Submission status: Wrong Answer

Solution code:
# N>=x>=0
# return max(floor(A*x/B)-A*floor(x/B))
# floor(t) は実数t以下の最大の整数
# x = Nの時が最大
A, B, N = [int(i) for i in input().split()]
x = N
y = (A * x)// B + A * (x//B)
print(y)

Submission status: Wrong Answer

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

for x in range(1, A+1):
  res = max(res, math.floor(A*x/B)-A*math.floor(x/B))
  if x == N:
    print(res)
    exit()

print(res)

Submission status: Wrong Answer

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

x = N

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

print(m)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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


if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

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

maxP=-10**15

if N<2000000:
    for i in range(1,N+1):
        tmp=(A*i)//B-A*(i//B)
        if maxP<tmp:
            maxP=tmp
        
else:
    for i in range(1,2000000):
        tmp=(A*i)//B-A*(i//B)
        if maxP<tmp:
            maxP=tmp
    for i in range(N-2000000,N+1):
        tmp=(A*i)//B-A*(i//B)
        if maxP<tmp:
            maxP=tmp
print(maxP)

Submission status: Wrong Answer

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

maxP=-10**15

if N<10000000:
    for i in range(1,N+1):
        tmp=(A*i)//B-A*(i//B)
        if maxP<tmp:
            maxP=tmp
        
else:
    for i in range(1,1000000):
        tmp=(A*i)//B-A*(i//B)
        if maxP<tmp:
            maxP=tmp
    for i in range(N-1000000,N+1):
        tmp=(A*i)//B-A*(i//B)
        if maxP<tmp:
            maxP=tmp
print(maxP)

Submission status: Wrong Answer

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

maxP=-10**15

if N<10000000:
    for i in range(1,N+1):
        tmp=(A*i)//B-A*(N//B)
        if maxP<tmp:
            maxP=tmp
        
else:
    for i in range(1,1000000):
        tmp=(A*i)//B-A*(N//B)
        if maxP<tmp:
            maxP=tmp
    for i in range(N-1000000,N+1):
        tmp=(A*i)//B-A*(N//B)
        if maxP<tmp:
            maxP=tmp
print(maxP)

Submission status: Wrong Answer

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

maxP=-10**15

if N<1000000:
    for i in range(1,N+1):
        tmp=(A*i)//B-A*(N//B)
        if maxP<tmp:
            maxP=tmp
        
else:
    for i in range(1,100000):
        tmp=(A*i)//B-A*(N//B)
        if maxP<tmp:
            maxP=tmp
    for i in range(N-1000,N+1):
        tmp=(A*i)//B-A*(N//B)
        if maxP<tmp:
            maxP=tmp
print(maxP)

Submission status: Wrong Answer

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

maxP=-10**15

for i in range(1,N+1):
    tmp=(A*i)//B-A*(N//B)
    if maxP<tmp:
        maxP=tmp
        
print(maxP)

Submission status: Wrong Answer

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

maxP=0

for i in range(1,N+1):
    tmp=(A*i)//B-A*(N//B)
    if maxP<tmp:
        maxP=tmp
        
print(maxP)

Submission status: Wrong Answer

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

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


N_MAX = 100000000

if N > N_MAX:
    for x in range(N_MAX):       
        f_new = math.floor(A*x/B) - A* math.floor(x/B)

        max_f = max(max_f, f_new)

else:
    for x in range((N%B)+1):

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

    
        max_f = max(max_f, f_new)
    
print(max_f)

Submission status: Wrong Answer

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

for x in range(N+1):
    if N > 10000000:
        if A % B ==0:
            max_f =0
        else:
            max_f = A-1
        break
        
    f_new = math.floor(x%B *( A /B))

    
    max_f = max(max_f, f_new)
    
print(max_f)

Submission status: Wrong Answer

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

for x in range(N+1):
    if N > 100000000:
        max_f = A-1
        break
        
    f_new = math.floor(x%B * A /B)

    
    max_f = max(max_f, f_new)
    
print(max_f)

Submission status: Wrong Answer

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

for x in range(N+1):
    if N > 10000000:
        max_f = A-1
        break
        
    f_new = math.floor(x%B * A /B)

    
    max_f = max(max_f, f_new)
    
print(max_f)

Submission status: Wrong Answer

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

for x in range(N+1):
    if N > 1000000:
        max_f = A-1
        break
        
    f_new = math.floor(x%B * A /B)

    
    max_f = max(max_f, f_new)
    
print(max_f)

Submission status: Wrong Answer

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 = [b-1,b,n-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: Wrong Answer

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 = [n-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: Wrong Answer

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

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)

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

print(ans)

Submission status: Wrong Answer

Solution code:
import math

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

Submission status: Wrong Answer

Solution code:
from math import floor
A,B,N = map(int, input().split())
before = 0
for x in range(N,-1,-1):
    now = A*x//B - A*(x//B)
    if now < before:
        break
    before = now
print(before)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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