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(' '))
c = min(N,B)
if c % B == 0:
    print(int(A(c-1)/B))
else :
    print(int(A(c)/B))

A,B,N = map(int, input().split(' '))
c = min(N,B)
if p % B == 0:
    print(int(A(c-1)/B))
else :
    print(int(A(c)/B))

import math
a, b, n = map(int, input().split())
p = min(b, n)
if p % b == 0:
    print(int(a(p-1)/b))
else:
    print(int((a(p))/b))

import math
a, b, n = map(int, input().split())
p = min(b, n)
if p % b == 0:
    print(int(a(p-1))/b)
else:
    print(int((a(p))/b))

A,B,N = map(int, input().split(' '))
p = min(N,B)
if p%B == 0:
    print(int(A(p-1)/B))
else :
    print(int(A(p)/B))

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

Verdicts: Runtime Error

Runtime Error

Runtime Error

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(x) for x in input().split())

x =  B - 1
if N < B
    x = N
a = math.floor(A * x / B) - A * math.floor(x / B)
b = math.floor(A * N / B) - A * math.floor(N / B)

if a > b:
    print(a)
else:
    print(b)

import math

A, B, N= (int(x) for x in input().split())

x =  B - 1
if N < B:
    x = N
a = math.floor(A * x / B) - A * math.floor(x / B)

print(a)

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= list(map(int, input().split()))
ma=0
for i in range(1000000):
    ma=max((a*i/b)//1-a*((i/b)//1),ma)
    ma=max((a*(n-i)/b)//1-a*(((n-i)/b)//1),ma)
print(int(ma))

a,b,n= list(map(int, input().split()))
ma=0
for i in range(10000):
    ma=max(int((a*i/b)//1-a*((i/b)//1)),ma)
    ma=max(int((a*(n-i)/b)//1-a*(((n-i)/b)//1)),ma)
print(ma)

a,b,n= list(map(int, input().split()))
if b==1:
    print(0)
    exit(0)
ma=(a*n/b)//1-a*((n/b)//1)
for i in range(b-1,n+1,b):
    tmp=(a*i/b)//1-a*((i/b)//1)
    ma=max(tmp,ma)
print(int(ma))

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());print(min(B-1,N))

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

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
x = int(input())
finished = False

a = max(0,int(math.pow(x,0.2)) - 1)
while a**5 - (a-1)**5 <= x:
    tmp = a**5 - x
    if tmp < 0:
        a += 1
        continue
    b = int(math.pow(tmp,0.2))
    if a**5 - b**5 == x:
        finished = True
        print(a,b)
        break
    a += 1
if not finished:
    a = 1
    while a**5 < x:
        tmp = x - a**5
        b = int(math.pow(tmp,0.2))
        if a**5 + b**5 == x:
            finished = True
            print(a,-b)
            break
        a += 1
        

val = a*n//b
for i in range(max(0,n//b - a), n//b):
    m = b*i - 1
    if (m > n) or (m < 0):
        continue
    else:
        val = max(val, (m*a)//b - i)
for i in range(max(0,n//b - a), n//b):
    m = b*i - 1
    if (m > n) or (m < 0):
        continue
    else:
        val = max(val, (m*a)//b - i)
        
print(val)

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

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

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

Verdicts: Runtime Error

Runtime Error

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):
a,b,n=map(int,input().split())
x=[]
x.append(int(a*n/b)-a*int(n/b))
if n>=b:
  t=int(n/b)
  x.append(int(a*(t*b-1)/b)-a*int((t*b-1)/b))
x.append(int(a*(b-1)/b)-a*int((b-1)/b))
print(max(x))

a,b,n=map(int,input().split())
x=[]
x.append(int(a*n/b)
if n>=b:
  x.append(int(a*(b-1)/b)
print(max(x))

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

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

A, B, N = map(int, input().split())
x = min(N,B-1)
print(A*x//B-A*(x//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())
ans = 0
x = 0
t = ((A * x) // B) - (A * (x // B))
while x >= 0:
    x += 1
    t2 = ((A * x) // B) - (A * (x // B))
    if t2 < t:
        ans = t
        break
    t = t2

print(ans)

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

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

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

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

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):
def main():
    a,b,n = map(int,input().split())
    aa = min(b,n)
    for i in range(aa,n):

        ans = max(ans,a*aa//b  - a * (aa//b))
    print(ans)
if __name__=='__main__':
    main()


def main():
    a,b,n = map(int,input().split())
    aa = min(b,n)
    ans = 0
    for i in range(aa,n):

        ans = max(ans,a*aa//b  - a * (aa//b))
    print(ans)
if __name__=='__main__':
    main()


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


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(i) for i in input().split()]

m = n - n % b if n >= b else 1

print((a * m // b) - a * (m // b))


a, b, n = [int(i) for i in input().split()]
m = b - 1 if n >= b else n

print((a * m // b) - a * (m // 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())
def kansu(x):
  S = floor(A*x/B)
  return S
print(min(kansu(N), kansu(B)))


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

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


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

input1 = input().split()
A = int(input1[0])
B = int(input1[1])
N = int(input1[2])

x = 0
result = 0
if N >= B-1:
    x = B-1
    result = (A*(x%B) - (A*x)%B)/B
elif N < B-1:
    x = N
    result = (A*(x%B) - (A*x)%B)/B

print(result)

import math

input1 = input().split()
A = int(input1[0])
B = int(input1[1])
N = int(input1[2])

result = 0
if N >= B-1:
    result = B-1
elif N < B-1:
    result = N

print(result)

import math

input1 = input().split()
A = int(input1[0])
B = int(input1[1])
N = int(input1[2])

x = 0
result = 0
if N >= B-1:
    x = B-1
    result = (A*(x%B) - (A*x)%B)/B
elif N < B-1:
    x = N
    result = (A*(x%B) - (A*x)%B)/B

print(int(result))

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())
List=[]
for x in range(n):
    k=math.floor((a*x)/b)-a*(math.floor(x/b))
    List.append(k)
    print(List)
print(List.index(max(List)))

a,b,n=list(map(int,input().split()))
x=min(b-1,n)
ans=int(a*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):
A,B,N = map(int,input().split())
m = 0
for x in range((min(A,N)*100)):
    m = max(m, int(A*x/B)-A*int(x/B))
print(m)

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


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

if b <= n:
    x = b-1

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


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):
#int(input())
#map(int,input().split())
#list(map(int,input().split()))

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

#int(input())
#map(int,input().split())
#list(map(int,input().split()))
import math
a,b,n=map(int,input().split())
l=[]
if n>=b:
    x=b-1
else:
    x=n
print(math.floor((a*x)/b)-a*math.floor(x/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())

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

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

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

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

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

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


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

if N < B:
	k = N
else:
	k = B

right = N
left = 0
for i in range(1, k+1):

	mid = left + math.floor(right - left) / 2
	print(mid)
	print(siki(A,B,mid))
	if max_value > siki(A,B,mid):
		right = mid
	else :
		left = mid

	if max_value < siki(A,B,mid):
		max_value = siki(A,B,mid)
	print(max_value)


print(max_value)


import math

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

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

if N < B:
	print(f(A,B,N))
else:
	print(f(A,B,B-1))


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())
ans = 0
imax = 0
for i in range(1,n+1):
    x = i
    z = math.floor(a*x/b)-a*math.floor(x/b)
    if z > imax:
        imax = z
        ans = i
print(ans)

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

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 main(a,b,n):
    res = 0
    r = n // b
    for i in range(1,min(b,n)+1):
        res = max(res,calc(a,b,i))
    for i in range((r-1)*b, n+1):
        res = max(res, calc(a,b,i))
    return res
    
def calc(a,b,x):
    return (math.floor(a*x/b) - a * math.floor(x/b))

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

##########
import math
ii = lambda:int(input())
li = lambda:list(map(int,input().split()))
##########
def main(a,b,n):
    x = min(b-1,n)
    return calc(a,b,x)

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

a,b,n = li()
print(main(a,b,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):
temp=list(map(int,input().rstrip().split()))
a=temp[0]
b=temp[1]
n=temp[2]
if (b-1)<n :
  x=(b-1)
else :
  x=n
v=((a*x)//b)-(a*(x//b))
print v
  
  

temp=list(map(int,input().rstrip().split()))
a=temp[0]
b=temp[1]
n=temp[2]
if (b-1)<n :
  x=(b-1)
else :
  x=n
v=((a*x)//b)-(a*(x//b))
print(v)

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

k = (N+1)//B

print(max(((A*B*k)-A)//B - (k-1)*A , A*N//B - A*(N//B)))


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

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

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

k = (N+1)//B

print(max(((A*B*k)-A)//B - (k-1)*A , (A*N)//B - A*(N//B)))

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

k = N//B

print(max(((A*B*k)-A)//B - (k-1)*A , (A*N)//B - A*(N//B)))

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

k = (N+1)//B

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

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

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


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

k = (N+1)//B

print(max( A*(B-1)//B , (A*N)//B - A*(N//B)))

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

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

Verdicts: Wrong Answer

Wrong Answer

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

for i in range(N+1):
    if((A*i)/B - A*(i/B) > bst):
        bst = (A*i)/B - A*(i/B)

print(bst)

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

import math

A, B, N = map(int,input().split())
bst = -pow(10, 10)

for i in range(N+1):
    if((floor((A*i)/B) - A*floor(i/B)) > bst):
        bst = floor((A*i)/B) - A*floor(i/B)

print(bst)

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

if p%B == 0:
    print(int(A*(p-1)//B))
else :
    print(int(A*(p)//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):
# -*- coding: utf-8 -*-
a, b, n = list(map(int, input().split()))
max_value = 0
trial = 100000
for x in range(0, trial):
    x = n - x
    # print('x', x)
    tmp = (x*a//b) - a*(x//b)
    # print(x*a//b, a*(x//b))
    # print('ans', tmp)
    # print('============')
    if (tmp > max_value):
        max_value = tmp
print(max_value)


# -*- coding: utf-8 -*-
a, b, n = list(map(int, input().split()))
max_value = 0
trial = n

x = min(b-1, n)
ans = x*a//b
ans -= 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):
arr = input().split(" ")
a, b, n = int(arr[0]), int(arr[1]), int(arr[2])
if b<=n:
   k = int((a*(b-1))/b)
else:
   k = int((a*n)/b)


arr = input().split(" ")
a, b, n = int(arr[0]), int(arr[1]), int(arr[2])
if b<=n:
   k = int((a*n)/b)
else:
   k = int((a*n)/b)

arr = input().split(" ")
a, b, n = int(arr[0]), int(arr[1]), int(arr[2])
if b<=n:
  k = a
else:
  k = (a*((n-1))//b
print(k)

arr = input().split(" ")
a, b, n = int(arr[0]), int(arr[1]), int(arr[2])
if b<=n:
   k = int((a*(b-1))/b)
else:
   k = int((a*n)/b)
print(k)

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

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

print(ans)

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

if B <= N:
  ans = (A*(B-1))//B
else:
  ans = (A*(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):
# coding: utf-8
# Your code here!
import math
line = list(map(int,input().split()))
A,B,N =line[0],line[1],line[2]

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

# coding: utf-8
# Your code here!
def main():
    import sys
    line = sys.stdin.readline
    A,B,N = map(int,input().split())
    if B>N:
        ans = A*N//B
    else:
        ans = A*(B-1)//B
    print(ans)

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
A,B,N=map(int,input().split())
a,b,x=0,0.1,0
while b>a:
    a=math.floor(A*x/B)-A*math.floor(x/B)
    b=math.floor(A*(x+1)/B)-A*math.floor((x+1)/B)
    x+=1
if N<=x:
    print(math.floor(A*N/B)-A*math.floor(N/B))
else:
    print(a)

A,B,N=map(int,input().split())
c=min(B-1,N)
print(int((A*c-A*c%B)/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())
ans = ((A*N)//B) - A * (N//B)
if B-1 >= N:
    tmp = ((A*(B-1))//B) - A * ((B-1)//B)
    ans = max(ans,tmp)
print(ans)

A,B,N = map(int,input().split())
ans = ((A*N)//B) - A * (N//B)
if B-1 <= N:
    tmp = ((A*(B-1))//B) - A * ((B-1)//B)
    ans = max(ans,tmp)
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):
def cal(i):
    return floor(a*i/b)-a*floor(i/b)
from  math import floor
a, b, n = map(int, input().split())
if b-1<n:
    ans = cal(b-1)
print(max(cal(ans), cal(0),cal(n)))

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

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

c = b-1

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

print(ans)

import math
a,b,n = map(int, input().split())
if b > n:
    c = n
else:
    c = b-1
ans = math.floor(a * c /b) - a * math.floor(c/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 sys import stdin
 
A, B, N = [int(x) for x in stdin.readline().rstrip().split()]
 
ans1 = int((A*N)/B)-A*(N/B)
 
if B-1<=N:
	ans2 = (A*(B-1))//B
else:
  	ans2=0
 
print(max(ans1,ans2))

from sys import stdin
import sys
 
A, B, N = [int(x) for x in stdin.readline().rstrip().split()]
# N, M = [int(x) for x in stdin.readline().rstrip().split()]
# U = input().split()
ans = int((A*N)/B)-A*int(N/B)
if B-1<=N:
	ans2 = int((A*(B-1))/B)-A*int((B-1)/B)
else:
  	ans2=0

print(ans2)


from sys import stdin
 
A, B, N = [int(x) for x in stdin.readline().rstrip().split()]
 
ans1 = ((A*N)//B)-A*int(N/B)
 
if B-1<=N:
	ans2 = (A*(B-1))//B
else:
  	ans2=0
 
print(max(ans1,ans2))

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):
comb = []
def f(n,cnt,ls):
    if cnt == n:
        comb.append(ls)
        return
    for i in range(ls[cnt-1],m+1):
        tmp = ls.copy()
        tmp[cnt] = i
        f(n,cnt+1,tmp)
    return
ma = lambda :map(int,input().split())
ni = lambda:int(input())

n,m,q = ma()
abcd = []
for i in range(q):
    abcd.append(list(ma()))
ls = [1]*(n+1)
f(n,0,ls)
ans = 0
for A in  comb:
    tmp = 0
    for a,b,c,d in abcd:
        if A[b-1] - A[a-1] ==c:
            tmp +=d
    ans = max(ans,tmp)
print(ans)


import collections
import math
import itertools
import sys
sys.setrecursionlimit(10**6)
def f(x):
  return (a*x)//b - a*(x//b)
ma = lambda :map(int,input().split())
ni = lambda:int(input())
a,b,n = ma()
if n>=b-1:
    print(f(b-1))
else:
    print(f(n))


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

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

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

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

if A == 1: print(0)
elif B == 1: print(0)

else:
  if N ==1: x=1
  elif N < B: x = N
  else:x = B-1
  print(int(A*x/B) - A*int(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 n<b:
  ans=int(a*n/b)-a*int(n/b)
else :
  ans=int(a*(n-1)/b)-a*int((n-1)/b)


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

if n<b:
  ans=int(a*n/b)-a*int(n/b)
else:
  ans=int(a*(b-1)/b)-a*int((b-1)/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() )

min_num = 1
max_num = N

def func( x ):
  return math.floor( A * x / B ) - A * math.floor( x / B )
  
ret = 0
while True:
  a = math.ceil( ( max_num + min_num ) / 2 )
  if func( max_num ) - func( min_num ):
    min_num = a
  else:
    max_num = a
  if max_num == min_num:
    break

print( func( a ))
   


import math
A, B, N = map( int, input().split() )
 
min_num = 1
max_num = N
 
def func( x ):
  return math.floor( A * x / B ) - A * math.floor( x / B )
  
ret = 0
while True:
  a = math.ceil( ( max_num + min_num ) / 2 )
  if func( min_num ) - func( max_num ) >= 0:
    min_num = a
  else:
    max_num = a
  if func( max_num ) == func( min_num ):
    break
 
print( func( a ))

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

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

print( func( 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):

#include <cstdio>
#include <algorithm>


#include <map>
#include <list>

#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <stack>
#pragma GCC optimize(3 , "Ofast" , "inline")
using namespace std ;
typedef long long ll ;
const double esp = 1e-6 , pi = acos(-1) ;
typedef pair<int , int> PII ;
const int N = 1e5 + 10 , INF = 0x3f3f3f3f , mod = 1e9 + 7;
ll in()
{
  ll x = 0 , f = 1 ;
  char ch = getchar() ;
  while(!isdigit(ch)) {if(ch == '-') f = -1 ; ch = getchar() ;}
  while(isdigit(ch)) x = x * 10 + ch - 48 , ch = getchar() ;
  return x * f ;
}
int main()
{
  ll a = in() , b = in() , n = in() ;
  ll l = 0 , r = n , ans = 0 ;
  while(l < r)
   {
     ll mid = l + r + 1 >> 1 ;
     if((a * mid) / b - a * (mid / b) >= ans) l = mid ;
     else r = mid - 1 ;
   }
  cout << (a * r) / b - a * (r / b) << endl ;
  return 0 ;
}
/*
*/


a , b , n = map(int , input().split())
l = 0
r = n
ans = 0
while (l < r) :
    mid = (l + r + 1) // 2
    if  (a * mid) // b - a * (mid // b) >= ans :
         ans =  (a * mid) // b - a * (mid // b)
         l = mid
    else :
        r = mid - 1
print((a * r) // b - 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):
def main():
    import sys
    import math
    sys.setrecursionlimit(10 ** 6)
    input = sys.stdin.readline
    A, B, N = [int(x) for x in input().strip().split()]
    ans = 0
    for x in range(N, N-A-1, -1):
        ans = max(ans, math.floor((A*x)/B)-A*math.floor(x/B), 0)
    
    print(ans)


if __name__ == '__main__':
    main()

def main():
    import sys
    import math
    sys.setrecursionlimit(10 ** 6)
    input = sys.stdin.readline
    A, B, N = [int(x) for x in input().strip().split()]
    ans = 0
    for x in range(min(N, B), max(min(N, B)-A-1, -1), -1):
        ans = max(ans, math.floor((A*x)/B)-A*math.floor(x/B), 0)
    
    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):
from math import floor
def main():
    A, B, N = map(int, input().split())
    x = max(B - 1, N)
    print(floor(A*x/B) - A*floor(x/B))
if __name__ == "__main__":
    main()

from math import floor


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

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


if __name__ == '__main__':
    main()


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
for i in range(10 ** 6):
  print(A * i // B - A * (i // B))
  ans = max(ans, A * i // B - A * (i // B))

for i in range(10 ** 6):
  i = N - i
  if i < 0:
    break
  ans = max(ans, A * i // B - A * (i // B))

print(ans)

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

ans = 0
for i in range(10 ** 5):
  print(A * i // B - A * (i // B))
  ans = max(ans, A * i // B - A * (i // B))

print(ans)

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

ans = 0
for i in range(10 ** 6):
  ans = max(ans, A * i // B - A * (i // B))

for i in range(10 ** 6):
  i = N - i
  if i < 0:
    break
  ans = max(ans, A * i // B - A * (i // B))

print(ans)

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

ans = 0
for i in range(10 ** 5):
  ans = max(ans, A * i // B - A * (i // B))

for i in range(10 ** 5):
  i = N - i
  ans = max(ans, A * i // B - A * (i // B))

print(ans)

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

ans = 0
for i in range(10 ** 5):
  ans = max(ans, A * i // B - A * (i // B))

print(ans)

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

ans = 0
for i in range(10 ** 8):
  print(A * i // B - A * (i // B))
  ans = max(ans, A * i // B - A * (i // B))

for i in range(10 ** 8):
  i = N - i
  if i < 0:
    break
  ans = max(ans, A * i // B - A * (i // B))

print(ans)

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

ans = 0
for i in range(10 ** 7):
  print(A * i // B - A * (i // B))
  ans = max(ans, A * i // B - A * (i // B))

for i in range(10 ** 7):
  i = N - i
  if i < 0:
    break
  ans = max(ans, A * i // B - A * (i // B))

print(ans)

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

ans = 0
for i in range(10 ** 5):
  ans = max(ans, A * i // B - A * (i // B))

for i in range(10 ** 5):
  i = N - i
  if i < 0:
    break
  ans = max(ans, A * i // B - A * (i // B))

print(ans)

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

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

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

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Time Limit Exceeded

Time Limit Exceeded

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

import math
import numpy as np


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




def func(x: np.ndarray) -> np.ndarray:
    return np.floor(A*x/B) - A*np.floor(x/B)


result = 0
x = np.arange(min(N, B-1), (N//2)+1, B)
x = func(x)
result = max(result, int(np.max(x)))
x = np.arange((N//2), N+1, B)
x = func(x)
result = max(result, int(np.max(x)))



print(result)


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

import math
import numpy as np


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




def func(x: np.ndarray) -> np.ndarray:
    return np.floor(A*x/B) - A*np.floor(x/B)


result = 0
x = np.arange(min(N, B-1), (N//2)+1, B)
x = func(x)
result = max(result, int(np.max(x)))
x = np.arange((N//2), N+1, B)
x = func(x)
result = max(result, int(np.max(x)))



print(int(np.max(x)))


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

import math


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


def f(x: int) -> int:
    
    return math.floor(A*x/B) - A*math.floor(x/B)


def main() -> None:
    """Entry point
    """
    
    
    result = f(min(B-1, N))

    
    print(result)


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):
(defun calc (x a b n)
  (- (floor (/ (* a x) b))
     (* a (floor (/ x b)))))

(let ((a (read))
      (b (read))
      (n (read)))
     (format t "~A" (if (<= b n)
                        (calc (1- b) a b n)
                        (calc n a b n))))


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

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

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

max - int(a*min(B-1,N)/B)
print(max)
~             

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

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

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
a, b, n = map(int, input().split())
x = np.arange(1, b+1)
y = np.floor(a * x / b) - a * np.floor(x / b)
print(y)
print(int(y.max()))

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

for i in range(1,120):
    for j in range(-120,120):
        if ((i**5)-(j**5))==x:
            print(i, j)
            exit()


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

x=min(N,B-1)

ans=((A*x)//B)-(A*(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 numpy as np
A,B,N=map(int,input().split())
x = np.array([j for j in range(B+1)])
val=np.floor(A*x/B)-A*np.floor(x/B)
print(int(np.max(val)))

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

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())
ans = 0
if B <=  N:
  for x in range(B-1,N+1,B):
    ans = max(ans, (A*x)//B - A*(x//B))
else:
  ans = floor((A*N)/B) - A*floor(N/B)
print(ans)

from math import floor
A,B,N = map(int,input().split())
ans = 0
if B <=  N:
  ans = floor(A*(B-1)/B) - A*floor((B-1)/B)
else:
  ans = floor((A*N)/B) - A*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):
import math
a, b, n = list(map(int,input().split()))
if b > n:
    print(math.floor(a*n/b))
elif n < 2*b - 1:
    print(max(math.floor(a*n/b)-a,math.floor(a*(b-1)/b))
else:
    print(a+math.floor((-1)*a/b))

import math
a, b, n = list(map(int,input().split()))
if b > n:
    print(math.floor(a*n/b))
elif n < 2*b - 1:
    print(max(math.floor(a*n/b)-a,math.floor(a*(b-1)/b)))
else:
    print(a+math.floor((-1)*a/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 math
A,B,N = map(int, input().split())
print(math.floor((A*(B-1))/B) - A*math.floor((B-1)/B))

import math
A,B,N = map(int, input().split())
print(math.floor((A*(B-1))/B) - A*math.floor((B-1)//B))


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

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


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 = list(map(int, input().split()))
res = 0
for x in range(1, n+1):
    print((a*x)//b, a *(x//b) )
    if  a *(x//b) != 0:
        break
    if res < (a*x)//b - a *(x//b):
        res = (a*x)//b - a *(x//b)

print(res)

a, b,n = list(map(int, input().split()))
if b > n:
    print((a*n)//b - a *(n//b))
elif b <= n:
    print((a*(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())
for i in range(b-1):
  tmp = (a*i) // b - a*(i // b)
  ans = 0
  ans = max(tmp,ans)
print(ans)

import math
a, b, n = map(int, input().split())
x = min(b-1, n)
print(math.floor(a*x/b)-a*math.floor(x/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):
# -*- coding: utf-8 -*-
"""
@author: H_Hoshigi
"""
def main():
    N, M, Q = map(int, input().split())
    r_list = []
    for i in range(Q):
        r_list.append(list(map(int, input().split())))
    max_score = 0
    a1 = 1
    for a2 in range(a1, M+1):
        for a3 in range(a2, M+1):
            for a4 in range(a3, M+1):
                for a5 in range(a4, M+1):
                    for a6 in range(a5, M+1):
                        for a7 in range(a6, M+1):
                            for a8 in range(a7, M+1):
                                for a9 in range(a8, M+1):
                                    for a10 in range(a9, M+1):
                                        a_list = [a1,a2,a3,a4,a5,a6,a7,a8,a9,a10]
                                        score = 0
                                        for r in r_list:
                                            if a_list[r[1]-1] - a_list[r[0]-1] == r[2]:
                                                score += r[3]
                                        max_score = max(score, max_score)
    print(max_score)

if __name__ == "__main__":
    main()




# -*- coding: utf-8 -*-
"""
@author: H_Hoshigi
"""
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():
    print(f(min(N, B-1)))

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):
a,b,n=list(map(int,input().split()))

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

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

x = 0
buf = []
while True:
    calc = int(a * x / b) - a * int(x / b)
    buf.append(calc)
    

    if a < x:
        break
    x += 1

ans = max(buf)
print(ans)

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

cnt = 1
buf = []
buf.append(int(a * n / b) - a * (int(n / b)))

while True:
    if n / b > 10 ** 6:
        break
    x = cnt * b - 1
    if n < x :
        break
    calc = int(a * x / b) - a * (int(x / b))
    if calc > max(buf):
        buf.append(calc)
    cnt += 1
    
buf.append(int(a * (b - 1) / b) - a * (int((b - 1) / b)))

ans = max(buf)
print(ans)

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

cnt = 1
buf = []
if n < b:
    buf.append(int(a * n / b) - a * (int(n / b)))
else:
    buf.append(int(a * (b - 1) / b) - a * (int((b - 1) / b)))
    

while True:
    if n / b > 10 ** 6:
        break
    x = cnt * b - 1
    if n < x :
        break
    calc = int(a * x / b) - a * (int(x / b))
    if calc > max(buf):
        buf.append(calc)
    cnt += 1
    
if n / b > 10 ** 6 and n >= b:
    buf.append(int(a * (b - 1) / b) - a * (int((b - 1) / b)))

ans = max(buf)
print(ans)

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

if b == 1 or a == 1:
    print(0)
else:
    r = min(b-1, n) 
    s = (a * r) // b - a * (r // b)
    print(r)

a, b, n = map(int, input().split()) 
if b == 1 or a == 1: 
    print(0) 
else: 
    r = min(b-1, n) 
    s = (a * r) // b - a * (r // b)    
    print(s)


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

  

max=0
for i in reversed(range(1, N+1)):
  y=float(math.floor(A*i/B))-A*float((math.floor(i/B)))
  if max < y :
    max=y
print(max)
  

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

max=0
if N>B:
  N=B-1
  y=math.floor(A*N/B)-A*math.floor(N/B)
  print(int(y))
elif N==B:
  N=B-1
  y=math.floor(A*N/B)-A*math.floor(N/B)
  print(int(y))
else:
	y=math.floor(A*N/B)-A*math.floor(N/B)
	print(int(y))
  

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


a,b,n=map(int,input().split())
x=min(b-1,n)
print((a*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):
import math
def solve():
    a, b, n = map(int, input().split())

    ans = 0
    for x in range(-1, n+1, b):
        ans = max(ans, math.floor(a*x/b) - a*math.floor(x/b))


    return ans


print(solve())


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

    if n < b:
        return math.floor(a*n/b) - a*math.floor(n/b)
    elif n >= b:
        return math.floor(a*(b-1)/b) - a*math.floor((b-1)/b)



print(solve())


Verdicts: Wrong Answer

Accepted