TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: 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.

Submission attempts (in order):
a,b,n=map(int,input().split())
m=0
for x in range(b-50000,b+1):
    if x<0:continue
    m=max(int(a*(x-1)/b)-a*int((x-1)/b),int(a*x/b)-a*int(x/b))
print(m)

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import numpy as np

def fLOOR(a,b,x):
    return np.floor(a * x / b) - a * np.floor(x / b)
"""
def fLOOR1(a,b,x):
    return np.floor(a * x / b)

def fLOOR2(a,b,x):
    return np.floor(x / b)
"""
def main():
    a,b,n = map(int, input().split(" "))
    
    """
    for x in range(n):
        x += 1
        val = fLOOR(a,b,x)
        val1 = fLOOR1(a,b,x)
        val2 = fLOOR2(a,b,x)
        print(val)
    """
    if b <= n:
        ans = fLOOR(a,b,b-1)
    else:
        ans = fLOOR(a,b,n)
    print(ans)

if __name__ == '__main__':
    main()

import numpy as np

def fLOOR(a,b,x):
    return np.floor(a * x / b) - a * np.floor(x / b)
"""
def fLOOR1(a,b,x):
    return np.floor(a * x / b)

def fLOOR2(a,b,x):
    return np.floor(x / b)
"""
def main():
    a,b,n = map(int, input().split(" "))
    
    """
    for x in range(n):
        x += 1
        val = fLOOR(a,b,x)
        val1 = fLOOR1(a,b,x)
        val2 = fLOOR2(a,b,x)
        print(val)
    """
    if b <= n:
        ans = fLOOR(a,b,b-1)
    else:
        ans = fLOOR(a,b,n)
    print(int(ans))

if __name__ == '__main__':
    main()

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
#-*-coding:utf-8-*-

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

#-*-coding:utf-8-*-

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
A, B, N = map(int, input().split())
ans = []
cnt = 0

for i in reversed(range(N-B+1, N+1)):
    ans.append((A * i // B) - A * (i // B))
    cnt += 1
    if cnt >= 10:
        break

print(max(ans))

import math

A, B, N = map(int, input().split())
x = min(B-1, N)
ans = math.floor(A * (x % B) / B)
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import math

A,B,N = map(int,input().split())
if A>B:
  print( math.floor(A*N/B) - A * math.floor(N/B))
  exit()
ans =0
for x in range(1,B):
  num = math.floor(A*x/B) - A * math.floor(x/B)
  if num > ans:
    ans = num
print(ans)

import math

A,B,N = map(int,input().split())
if A>B:
  print(N)
  exit()
ans =0
for x in range(1,B):
  num = math.floor(A*x/B) - A * math.floor(x/B)
  if num > ans:
    ans = num
print(ans)

A,B,N =map(int,input().split())
ans =0
for x in range(1,N+1):
  num = math.floor(A*x/B) - A * math.floor(x/B)
  if num > ans:
    ans = num

print(ans)

import math

A,B,N = map(int,input().split())
if B>N:
  print( math.floor(A*N/B) - A * math.floor(N/B))
  exit()
print( math.floor(A*(B-1)/B) - A * math.floor((B-1)/B))

Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import sys
from math import floor
input = sys.stdin.readline
a,b,n = map(int,input().split())
li = []
append = li.append
 
#for x in range(n+1):
#    append(int((a*(x))/b) - a * int(x/b))
#print(max(li))
def f(x):
    return floor((a*(x))/b) - a * floor(x/b) 
li = [f(x) for x in range(n+1)]
print(li)
if max(li) > n:
    print(0)
else:
    print(max(li))

import math
a,b,n = map(int,input().split())
#li = []
 
#for x in range(n+1):
ans = (math.floor((a*(n))/b) - (a * math.floor(n/b)))

 
#print(max(li))
if max(li) > n:
    print(0)
else:
    print(max(li))


import math
 
A, B, N = map(int, input().split())
 
 
ans1 = 0
 
if N > B - 1:
    x = B-1
    print(int((A * x) / B) - A * int(x / B))
elif N <= B - 1:
    x = N
    print(int((A * x) / B) - A * int(x / B))

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
a, b, n = map(int, input().split())
ans = 0
for i in range(int(b/a), n+1):
  if ans < int(a*i/b)-a*int(i/b);
    ans = ans, int(a*i/b)-a*int(i/b)
  else:
    break
print(ans)

a, b, n = map(int, input().split())
ans = 0
e = min(n+1,b)
s = max(int(b/a),e-1000)
for i in range(s, e):
  x = (int(a*i/b)-a*int(i/b))
  if ans < x:
    ans = x
print(ans)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
A, B, N = map(int, input().split())

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

ans = 0
for x in range(N+1):
    fir = (A*x)//B
    sec = x//B
    ans = max(ans, fir - A * sec)

    
    if ans == B-1:
        break

print(ans)


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

if N < B:
    print((A*N)//B)
else:
    qa, ra = divmod(A, B)
    rx = B-1
    print(qa*rx + (ra*rx)//B)


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import math

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

i = 1
maxnum = 1
while i <= N:
    if ((A * (i-1) // B) - A * ((i-1) // B)) < ((A * (i) // B) - A * ((i) // B)):
        maxnum = ((A * (i) // B) - A * ((i) // B))
        i = i + 1

print(maxnum)


import math

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

i = 1
maxnum = 1
while i <= N:
    if (math.floor(A * (i-1) // B) - A * ((i-1) // B)) < math.floor((A * (i) // B) - A * ((i) // B)):
        maxnum = math.floor((A * (i) // B) - A * ((i) // B))
        i = i + 1

print(maxnum)


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



Verdicts: Time Limit Exceeded

Time Limit Exceeded

Accepted
Problem: 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.

Submission attempts (in order):
a,b,c=map(float,input().split())
x=max(b-1,c)
import math
print(math.floor(a*x/c)-a*math.floor(x/c))

a,b,c=map(float,input().split())
x=min(b-1,c)
import math
print(int(math.floor(a*x/b)-a*math.floor(x/b)))

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a,b,n = map(int,input().split())
if a == 1 or b == 1:
    print(0)
    exit()

prev = 0

for x in range(min(b-1,n),n+1, b):
    val = floor(a*x/b) - a*floor(x/b)
    if val < prev:
        print(prev)
        exit()
    prev = val

val = floor(a*n/b) - a*floor(n/b)
print(max(prev,val))



from math import floor
a,b,n = map(int,input().split())
if a == 1 or b == 1:
    print(0)
    exit()

prev = 0

for x in range(min(b-1,n),n+1, b):
    val = floor(a*x/b) - a*floor(x/b)
    if val < prev:
        print(prev)
        exit()
    prev = val

val = floor(a*n/b) - a*floor(n/b)
print(max(prev,val))



Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import math
a,b,n = map(int,input().split())

x = 0
k = 0
while x<n:
    x += b/a
    k += 1
    print(x,k)
print(k-1)

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

if b =< n:
    k = math.floor(n/b)
    ans = max(math.floor(a*(b-1)/b), math.floor(a*n/b)- a*math.floor(n/b),math.floor(a*(k*b-1)/b)-a*math.floor((k*b-1)/b))
    print(ans)
else:
    print(math.floor(a*n/b))


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


Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
#D
a,b,n = map(int,input().split())

print(min(n,b-1))


#D
a,b,n = map(int,input().split())
k = min(n,b-1)

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


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import sys
import math

lines = sys.stdin.readlines()

X = lines[0].split(' ')
A = int(X[0])
B = int(X[1])
N = int(X[2])

m = A // B
j = A % B

if N >=B-1:
    print(m*(B-1)-1+j)
else:
    k = B-N
    print(max(0,j+m*N-math.ceil(j*k/B))
    

import sys
import math

lines = sys.stdin.readlines()

X = lines[0].split(' ')
A = int(X[0])
B = int(X[1])
N = int(X[2])

m = A // B
j = A % B

if N >=B-1:
    print(max(0,m*(B-1)-1+j))
else:
    k = B-N
    print(max(0,j+m*N-math.ceil(j*k/B)))

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
A, B, N = map(int, input().split())



r = N if N < B else r = B-1

print( A*r // B )

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



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

print( A*r // B )

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
a, b, n = map(int, input().split())
x = min(b-1, n)
ans = max(int((a*x)/b) - a*int(x/b))
print(ans)


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


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
from math import floor
A,B,N=map(int, input().split())

def calc(x):
    return floor((A*x)/B)-A*floor(x/B)

print(calc(B-1))

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

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a,b,n=map(int,input().split())
pmax=0
for i in range(1,n+1):
    p = i/b - i//b
    if pmax < p:
        pmax=p
        print(i,pmax)
print(int(pmax*a))

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
A, B, N = map(int, input().split(" "))
ans = 0
x = B-1
if B-1 > N:
    floor = int(A*x/B)
else:
    floor = int(A*N/B) - A * int(N/B)
print(floor)

A, B, N = map(int, input().split(" "))
ans = 0
x = B-1
floor1 = int(A*x/B)
floor2 = int(A*N/B) - A * int(N/B)
print(max(floor1,floor2))

A, B, N = map(int, input().split(" "))
ans = 0
x = min(B-1,N)
floor = int(A*x/B) - A * int(x/B)
print(floor)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import math
A,B,N = [int(i)for i in input().split()]
tmpmax=0
for i in range(N+1):
  tmp=math.floor(A*i/B)-A*math.floor(i/B)
  if tmp > tmpmax:
    tmpmax = tmp
  elif tmp < tmpmax:
    continue
  elif tmp == tmpmax:
    break
print(tmpmax)

import math
A,B,N = [int(i)for i in input().split()]
tmpmax=0
for i in range(N+1):
  tmp=math.floor(A*i/B)-A*math.floor(i/B)
  if tmp > tmpmax:
    tmpmax=tmp
  if tmp == tmpmax:
    break
print(tmpmax)

import math
A,B,N = [int(i)for i in input().split()]

def func(A, B, N):
  if N>B-1:
    return math.floor(A*(B-1)/B)-A*math.floor((B-1)/B)
  else:
    return math.floor(A*N/B)-A*math.floor(N/B)


print(func(A,B,N))

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import math
A,B,N = map(int,input().split())
C = N - N%B
D = A*(C-1)
ans = math.floor(D/B)　-　A * math.floor((C-1)/B)
if B > N:
    ans = math.floor(A*N/B) - A*math.floor(N/B)
print(ans)

import math
A,B,N = map(int,input().split())
C = N - N%B
ans = A*(C-1) // B - A*math.floor((C-1)/B)
if B > N:
    ans = math.floor(A*N/B) - A*math.floor(N/B)
print(ans)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
a,b,n = map(int,input().split())

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

print(ans)

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

x = list()
if n<=b:
  for i in range(n+1):
    y = int(a*i/b) - a*int(i/b)
    x.append(y)
else:
  for i in range(b):
    y = int(a*i/b) - a*int(i/b)
    x.append(y)
x = sort(x)
print(x[-1])


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

x = list()
if n<=b:
  for i in range(n+1):
    y = int(a*(i+1)/b) - a*int((i+1)/b)
    x.insert(bisect.bisect_left(x,y),y)
else:
  for i in range(b):
    y = int(a*(i+1)/b) - a*int((i+1)/b)
    x.insert(bisect.bisect_left(x,y),y)

print(x[-1])


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

x = list()
for i in range(n):
  y = int(a*(i+1)/b) - a*int((i+1)/b)
  x.insert(bisect.bisect_left(x,y))

print(x[-1])


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


Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
A,B,N = [int(v) for v in input().split()]

def calc(a,b,x):
    return int(((a*x)/B)) - a * int(x/b)

ans = -1
x = 0
while True:
    c = calc(A,B,x)
    if ans >= c:
        break
    else:
        ans = c
    x+=1
print(ans)


A,B,N = [int(v) for v in input().split()]

def calc(a,b,x):
    return int(((a*x)/B)) - a * int(x/b)

ans = -1
x = 0
while True:
    c = calc(A,B,x)
    if ans >= c or x > N:
        break
    else:
        ans = c
    x+=1
print(ans)


A,B,N = [int(v) for v in input().split()]

def calc(a,b,x):
    return int(((a*x)/B)) - a * int(x/b)

ans = -1
x = 0
for x in range(0,min(A,N)+1):
    c = calc(A,B,x)
    if ans >= c or x > N:
        break
    else:
        ans = c
    x+=1
print(ans)


A,B,N = [int(v) for v in input().split()]

def calc(a,b,x):
    return int(((a*x)/B)) - a * int(x/b)

def lcm(a,b):
    if a < b:a,b = b,a
    while a%b != 0:
        a,b = b,a%b
    return b

if B <= N+1:
    print(calc(A,B,B-1))
else:
    print(calc(A,B,N))


Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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)

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

import math

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import math

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

if B - 1 <= N:
    x = B - 1
else:
    x = N
    print('h')

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



import math

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

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

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



Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
q = min(b-1,n)
ni = int(a*q/b)
if ni > nmax:
        nmax = ni
print(nmax)

#abc 165
# d
a,b,n = map(int,input().split())
nmax = 0


#     ni = int(a*i/b)
#     if ni > nmax:
#         nmax = ni
# print(nmax)

q = min(b-1,n)
ni = int(a*q/b)
if ni > nmax:
        nmax = ni
print(nmax)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
i = list(map(int, input().split()))
A = i[0]
B = i[1]
N = i[2]
a = -10 ** 20
for x in range(1, N+1):
  s = A * x // B
  t_0 = x // B
  t = A * t
  u = s - t
  if u > a:
    a = u
print(a)    

[A, B, N] = list(map(int, input().split()))
if N < B-1:
    print(A * N // B)
else:
    print(A * (B-1) // B)
    
    


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import sys
A,B,N=map(int,input().split())
X=B-1
X=max(B-1,N)
ans=(A*X)//B-A*(X//B)
print(ans) 

import sys
A,B,N=map(int,input().split())
X=B-1
X=min(B-1,N)
ans=(A*X)//B-A*(X//B)
print(ans) 

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
from math import floor, ceil

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


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



from math import floor, ceil

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


num = n-n%b-1

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


from math import floor, ceil

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


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



from math import floor, ceil

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

num = min(b-1, n)

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



# ans = 0

#     tmp = floor(a*i/b) - a*floor(i/b)
#     print("i", i, "tmp", tmp)
#     ans = max(ans, tmp)


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

# else:
#     print(a-1)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a, b, n = map(int, input().split())

l = []
for i in range(n//b +1):
    result = a*(b*(i+1)-1)//b - a*i
    l.append(result)
ans = max(l)

print(ans)

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

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a,b,n=map(int,input().split())
x=0
if n>b:
    x=b
else:
  x=n
ans1=int(a*x/b)-a*int(x/b)
print(ans2)

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import math

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

m = 0
for i in range(min(a, b, n), n + 1):
    print(math.floor(a * i / b), a * math.floor(i / b))
    m = max(m, math.floor(a * i / b) - a * math.floor(i / b))

print(m)

import math

a, b, n = [int(x) for x in input().split()]
# a = 10 ** 6
# b = 10 ** 12
# n = 10 ** 12

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

print(m)


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
A, B, N = map(int, input().split())
print(B)

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
A,B,N = [int(i) for i in input().split()]
x = N
M = A*N//B
ans = -float("inf")

for _ in range(10**6):
    s = A*x//B - A*(x//B)
    ans = max([ans,s])
    x -= 1

print(ans)

A,B,N = [int(i) for i in input().split()]
t = min([N,B-1])
print((A*t//B))

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a, b, n = map(int, input().split())

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

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

x = 0
ans = 0
if n < b:
    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)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import math

A, B, N = map(int, input().split())
max = 0
temp = 0
bk_temp = 0

for i in range(1, N + 1):
    temp = math.floor(A*i/B) - (A * math.floor(i/B))
    print(str(i) + ' ' + str(temp))
    if bk_temp > temp:
        max = bk_temp
        break
    if max < temp:
        max = temp
    bk_temp = temp

print(max)

import math

A, B, N = map(int, input().split())
max = 0
temp = 0
bk_temp = 0

if B <= N:
    max = math.floor(A * (B - 1) / B) - (A * math.floor((B - 1) / B))
else:
    
    
    #     print(str(i) + ' ' + str(temp))
    #     if bk_temp > temp:
    #         max = bk_temp
    #         break
    #     if max < temp:
    #         max = temp
    #     bk_temp = temp
    max = math.floor(A * N / B) - (A * math.floor((N) / B))

print(max)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a, b, n = map(int, input().split())
def func(i, j, k):
    return (i*k)//j
m = min(n, b)
r = (a*min(n, b)) // b
while ((a*m) // b) == r:
    print(m)
    m -= 1
print(func(a, b, m+1))

a, b, n = map(int, input().split())
def func(i, j, k):
    return (i*k)//j - i*(k//j)
m = min(n, b-1)
r = (a*min(n, b-1)) // b
while ((a*m) // b) == r:
    m -= 1
print(func(a, b, m+1))

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
#!/usr/bin/env python3

import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
#%%code
def resolve():
    A,B,N=pin()
    def f(A,B,x):
        t=(A*x)//B
        s=x//B
        return t-A*s
    xans=N-(N%B)-1
    if xans>N:xans=N
    print(f(A,B,xans))
#%%submit!
resolve()

#!/usr/bin/env python3

import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
#%%code
import random
def resolve():
    A,B,N=pin()
    def f(A,B,x):
        t=(A*x)//B
        s=x//B
        return t-A*s
    ans=0
    for i in range(10**6):
        k=random.randint(0,N)
        ans=max(ans,f(A,B,k))
    print(ans)
#%%submit!
resolve()

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a,b,n = map(int,input().split())

if n >= 2 * b - 1:
    ans = (a * (2 * b - 1)) // b - a
    print(ans)
else:
    ans = (a * (2 * n - 1)) // b - a * n //b
    print(ans)

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

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

ans = min(b - 1, n)
print(ans)

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

temp = a * b // math.gcd(a, b) - 1
temp = min(temp, n - (n%b+1))
ans = (a * temp)//b - a * (temp//b)
print(ans)

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

if n >= 2 * b - 1:
    ans = a * (2 * b - 1) // b - a
    print(ans)
else:
    ans = (a * (2 * n - 1)) // b - a * n //b
    print(ans)

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

temp = a * b // math.gcd(a, b) - 1
temp1 = n - (n % b + 1) if n%b != n else n
temp = min(temp, temp1)
#print(temp)
ans = (a * temp)//b - a * (temp//b)
print(ans)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
A,B,N = map(int, input().split())
max = 0
for i in range(1,B):
    if max <= int(i*A/B):
        max = int(i*A/B)
print(max)

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
A,B,N=map(int,input().split())
def f(x):
  return int(A*x/B)-A*int(x/B)

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

A,B,N=map(int,input().split())
import numpy as np
print(max([int(A*x/B)-A*int(x/B) for x in np.arange(0,N+1,max((B/A),1))])

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

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

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import math
A, B, N = map(int, input().split())
ans = []
for x in range(0, 10**3):
    cal = math.floor((A*x)/B) - (int(A) * math.floor(x/B))
    ans.append(cal)
for x in range(N-10**7, N+1):
    cal = math.floor((A*x)/B) - (int(A) * math.floor(x/B))
    ans.append(cal)
print(max(ans))

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

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

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

import math
A, B, N = map(int, input().split())
ans = []
for x in range(0, 10**3):
    cal = math.floor((A*x)/B) - (int(A) * math.floor(x/B))
    ans.append(cal)
for x in range(N-10**7, N+1):
    cal = math.floor((A*x)/B) - (int(A) * math.floor(x/B))
    ans.append(cal)
print(max(ans))

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

import math
A, B, N = map(int, input().split())
ans = []
for x in range(0, 10**6):
    cal = math.floor((A*x)/B) - (int(A) * math.floor(x/B))
    ans.append(cal)
for x in range(N-10**6, N+1):
    cal = math.floor((A*x)/B) - (int(A) * math.floor(x/B))
    ans.append(cal)
print(max(ans))

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


import math
A, B, N = map(int, input().split())
ans = []
for x in range(0, 10**5):
    cal = math.floor((A*x)/B) - (int(A) * math.floor(x/B))
    ans.append(cal)
for x in range(N-10**5, N+1):
    cal = math.floor((A*x)/B) - (int(A) * math.floor(x/B))
    ans.append(cal)
print(max(ans))

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

Verdicts: Time Limit Exceeded

Runtime Error

Runtime Error

Wrong Answer

Time Limit Exceeded

Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import sys
from math import sqrt, floor

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


def I():
    return int(input())


def MI():
    return map(int, input().split())


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

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


if __name__ == "__main__":
    main()


import sys
from math import sqrt, floor

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


def I():
    return int(input())


def MI():
    return map(int, input().split())


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

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


if __name__ == "__main__":
    main()


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import math


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

    for x in range(1, 100):
        temp = math.floor(A*x/B) - A * math.floor(x/B)
        if temp < N:
            ans = temp
        else:
            print(ans)
            break


if __name__ == '__main__':
    main()

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import math

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

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



print(func(A, B, B-1))

import math

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

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

i = 1
max_x = -9999999
max = -9999999
while (i <= N):
    ans =func(A, B, i) 
    if (ans > max):
        max = ans
        max_x = i

print(max)

import math

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

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



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

Verdicts: Wrong Answer

Time Limit Exceeded

Accepted
Problem: 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.

Submission attempts (in order):
a,b,n = map(int,input().split())


x = b-1

if b > n:
  res = int(a/b)

else :
  res = int((a/b)*(b-1))
  
print(res)


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


x = b-1

if b > n:
  res = int((a/b)*n)

else :
  res = int((a/b)*(b-1))
  
print(res)


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import math

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

if b <= 10**6
    maxVal = 0

    for i in range(b):
        if i > n:
            break
        val = math.floor(a*i/b)-a*math.floor(i/b)
        if val > maxVal:
            maxVal = val

    print(maxVal)
elif n > b:
    print(a-1)
elif n == b:
    m = n - 1
    print(math.floor(a*m/b)-a*math.floor(m/b))
else:
    print(math.floor(a*n/b)-a*math.floor(n/b))

import math

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

if b <= 10**6:
    maxVal = 0

    for i in range(b):
        if i > n:
            break
        val = math.floor(a*i/b)-a*math.floor(i/b)
        if val > maxVal:
            maxVal = val

    print(maxVal)
elif n > b:
    print(a-1)
elif n == b:
    m = n - 1
    print(math.floor(a*m/b)-a*math.floor(m/b))
else:
    print(math.floor(a*n/b)-a*math.floor(n/b))


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import numpy as np
def main():
    A, B, N = map(int, input().split())
    max_value = 0
    if N < B:
        np.floor(A*(N-1)/B)
    else:
        for x in range(N+1):
            value = np.floor(A*x/B) - A * np.floor(x/B)
            #print(x, value)
            if value > max_value:
                max_value = value
    print(int(max_value))
    
if __name__ == '__main__':
    main()

import numpy as np
def main():
    A, B, N = map(int, input().split())
    max_value = 0
    if N < B:
        np.floor(A*N/B)
    else:
        for x in range(N+1):
            value = np.floor(A*x/B) - A * np.floor(x/B)
            #print(x, value)
            if value > max_value:
                max_value = value
    print(int(max_value))
    
if __name__ == '__main__':
    main()

import numpy as np
def main():
    A, B, N = map(int, input().split())
    max_value = 0
    if N < B:
        np.floor(A*(B-1)/B)
    else:
        for x in range(N+1):
            value = np.floor(A*x/B) - A * np.floor(x/B)
            #print(x, value)
            if value > max_value:
                max_value = value
    print(int(max_value))
    
if __name__ == '__main__':
    main()

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

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):

import math

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


for x in range(1, n+1):
    if x > b - 1:
        break
    tmp = math.floor(a*x/b) - a*math.floor(x/b)
    print(x, tmp)
    if tmp >= ans:
        ans = tmp

print(ans)

import math

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

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

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

print(ans)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
from math import floor,ceil
a,b,n = map(int,input().split())

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


if a*n < b:
  print(f(b-1))
else:  
  ans = 0
  for i in range(1,min(a+1,n+1)):
    ans = max(ans,f(i))

from math import floor

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

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

from math import floor

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

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

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
A, B, N = map(int, input().split())
Ymax=0

for i in range(B+1):
  x = i+1
  XB = float(x)/float(B)
  Y = int(float(A)*XB) - A * int(XB)
  if Y>Ymax:
    Ymax = Y
print(Ymax)

A, B, N = map(int, input().split())
print(A*x//B - A*(x//B))

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

for i in range(N,N-B,-1):
  x = i+1
  Y = int(float(A)*float(x)/float(B)) - A * int(float(x)/float(B))
  if Y>Ymax:
    Ymax = Y
print(Ymax)

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

for i in range(N,N-B,-1):
  x = i+1
  Y = int(float(A)*float(x)/float(B)) - A * int(float(x)/float(B))
  if Y>Ymax:
    Ymax = Y
  print(x)
print(Ymax)

A, B, N = map(int, input().split())
Y = A*x//B - A*(x//B)
print(Y)

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

Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
def main():
    A, B, N = (int(x) for x in input().split())
    mini = 0
    if N >= B:
        for x in range(B-1, N+1, B):
            k = x / B
            ans = int(A*k) - int(k)
            if ans > mini:
                mini = ans
    else:
        ans = int(A*(B-1)/B)
    print(ans)


if __name__ == "__main__":
    main()

def main():
    A, B, N = (int(x) for x in input().split())
    mini = 0
    if N >= B:
        ans = int(A*(B-1)/B)
    else:
        ans = int(A*(N)/B)
    print(ans)


if __name__ == "__main__":
    main()

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
#!/usr/bin/env python3
import sys
import math

def solve(A: int, B: int, N: int):

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

    return


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


    #!/usr/bin/env python3
    import sys
    import math
     
    def solve(A: int, B: int, N: int):
     
        x = min(B-1, N)
        print(math.floor(A*x/B) - A*math.floor(x/B))
     
        return
     
     
    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()

#!/usr/bin/env python3
import sys
import math

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


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


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import math
A, B, N = (int(i) for i in input().split())  
ans = 0
for x in range(N, N - A - 1, -1):
  result = math.floor(A * x / B) - A * math.floor(x/B)
  ans = max(ans, result)
print(ans)



import math
A, B, N = (int(i) for i in input().split())  
ans = 0
for x in range(0, 100000):
  result = math.floor(A * x / B) - A * math.floor(x/B)
  ans = max(ans, result)
    
print(ans)



import math
A, B, N = (int(i) for i in input().split())  
ans = 0
for x in range(0, A+10):
  result = math.floor(A * x / B) - A * math.floor(x/B)
  ans = max(ans, result)
    
print(ans)



import math
A, B, N = (int(i) for i in input().split())  

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

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



Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import math


nums = [int(e) for e in input().split()]

a = nums[0]
b = nums[1]
n = nums[2]

max_score = -1
score = -1

while True:
    score = math.floor(a*x/b) - a* math.floor(x/b)
    if max_score < score:
        max_score = score
    elif x > n:
        break

print(max_score)

import math


nums = [int(e) for e in input().split()]

a = nums[0]
b = nums[1]
n = nums[2]

max_score = -1
score = -1
x = 1

while True:
    score = math.floor(a*x/b) - a* math.floor(x/b)
    if max_score < score:
        max_score = score
        x += 1
    elif x > n:
        break

print(max_score)


import math


nums = [int(e) for e in input().split()]

a = nums[0]
b = nums[1]
n = nums[2]

max_score = -1
score = -1

# for x in range(1, n+1):
#     score = math.floor(a*x/b) - a* math.floor(x/b)
#     if max_score < score:
#         max_score = score
#     elif x > b:
#         break

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

print(max_score)

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
A,B,N=[int(s) for s in input().split()]
print(((B-1)*A)//B)

import time
start=time.time()
A,B,N=[int(s) for s in input().split()]
x=((N+1)//B)*B-1
ans=set()
ans.add((A*N)//B-A*(N//B))
while x>0:
  ans.add((A*x)//B-A*(x//B))
  x-=B
  if (time.time()-start)>1.7:
    break
print(max(ans))


Verdicts: Wrong Answer

Accepted