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):
#!usr/bin/env pypy3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate, combinations_with_replacement, compress
import sys
import math
import bisect


def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


def LS(): return [list(x) for x in sys.stdin.readline().split()]


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


def LIR(n):
    return [LI() for i in range(n)]


def SR(n):
    return [S() for i in range(n)]


def LSR(n):
    return [LS() for i in range(n)]


sys.setrecursionlimit(1000000)


def main():
    N, M, Q = LI()
    abcd = [LI() for _ in range(Q)]
    ans = 0

    for A in combinations_with_replacement(range(1, M + 1), N):
        tmp = 0
        for (a, b, c, d) in abcd:
            tmp += d if (A[b-1] - A[a-1] == c) else 0
        ans = max(ans, tmp)
    print(ans)


main()


from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate, combinations_with_replacement, compress
import sys
import math
import bisect


def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


def LS(): return [list(x) for x in sys.stdin.readline().split()]


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


def LIR(n):
    return [LI() for i in range(n)]


def SR(n):
    return [S() for i in range(n)]


def LSR(n):
    return [LS() for i in range(n)]


sys.setrecursionlimit(1000000)


def main():
    N, M, Q = LI()
    abcd = [LI() for _ in range(Q)]
    ans = 0

    for A in combinations_with_replacement(range(1, M + 1), N):
        tmp = 0
        for (a, b, c, d) in abcd:
            tmp += d if (A[b-1] - A[a-1] == c) else 0
        ans = max(ans, tmp)
    print(ans)


main()


from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate, combinations_with_replacement, compress
import sys
import math
import bisect


def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


def LS(): return [list(x) for x in sys.stdin.readline().split()]


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


def LIR(n):
    return [LI() for i in range(n)]


def SR(n):
    return [S() for i in range(n)]


def LSR(n):
    return [LS() for i in range(n)]


sys.setrecursionlimit(1000000)


def main():
    A, B, N = LI()
    print(int(A / B * min(N, B - 1)))


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

from math import ceil
a,b,n=map(int,input().split())
p=n//b
if p==0:
  print((a*n)//b)
else:
  print(a-ceil(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 = list(map(int, input().split()))
x = b-1
t = int(a*x/b) -a*int(x/b)


print(t)


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


print(t)


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

print(t)



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

x = math.floor(a*n/b)-( a*math.floor(n/b))
y = math.floor(a*b/b)-( a*math.floor(b/b))
z = math.floor(a*(b-1)/b)-( a*math.floor((b-1)/b))

if b == 1:
    print(0)
elif n < b:
    print(x)
else:
    print(z)

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

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

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

x = math.floor(a*n/b)-( a*math.floor(n/b))
y = math.floor(a*b/b)-( a*math.floor(b/b))
z = math.floor(a*(b-1)/b)-( a*math.floor((b-1)/b))

if b == 1:
    print(0)
elif n < b:
    print(x)
else:
    print(z)

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

a,b,n=map(int,input().split())
x = min(b-1,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):
import math
a,b,n = map(int,input().split())
ans = -10000000000 
for i in range(0,n+1):
    kari = math.floor(a*i/b) - a*math.floor(i/b)
    if ans < kari:
        ans = kari
    else:
        break
print(ans)

import math
a,b,n = map(int,input().split())
if b <= 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):
from decimal import Decimal
import math
a,b,n = map(str,input().split())

a = Decimal(a)
b = Decimal(b)
n = int(n)
ans = 0
kouho = [b-1,b,n-1,n]
for x in kouho:
    tmp = math.floor((a*x)/b) - a*math.floor(x/b)
    ans = max(ans,tmp)
print(ans)

from decimal import Decimal
import math
a,b,n = map(str,input().split())

a = Decimal(a)
b = Decimal(b)
n = int(n)
ans = 0
kouho = [min(b-1,n)]
for x in kouho:
    tmp = math.floor((a*x)/b) - a*math.floor(x/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):
a, b, n = map(int, input().split(" "))

print(max([math.floor(a * i / b) - a * math.floor(i / b) for i in range(1, n + 1)]))


import math
 
a, b, n = map(int, input().split(" "))
i = min([b-1 , n])
print( math.floor(a*i / b) - a * math.floor(i / 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):
l = list(map(int,input().split()))
a = l[0]
b = l[1]
n = l[2]

def floor(a,b,x):
    p = (a*x)//b - a*(x//b)
    return p

max = 0
maxn = 0
for i in range(n+1):
    c = floor(a,b,i)
    if c >= max:
        max = c
        maxn = i

print(maxn)

l = list(map(int,input().split()))
a = l[0]
b = l[1]
n = l[2]

def floor(a,b,x):
    p = (a*x)//b - a*(x//b)
    return p

max = 0
if b == 1:
    max = 0
elif n <= b-1:
    max = floor(a,b,n)
elif n > b-1:
    for i in range(b-1,n+1,b):
        c = floor(a,b,i)
        if c >= max:
            max = c

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):
import math
A,B,N = (int(x) for x in input().split())
a = (N//B)*B-1
if a < 0:
  ans = math.floor(A*0/B) - A*math.floor(0/B)
else:
  ans = math.floor(A*a/B) - A*math.floor(a/B)
if ans > math.floor(A*N/B)-A*math.floor(a/B):
  re = ans
else:
  re = math.floor(A*N/B)-A*math.floor(a/B)
print(re)



import math
A,B,N = (int(x) for x in input().split())
a = (N//B)*B-1
if a < 0:
  a = 0
  ans = (A*a)//B - A*math.floor(a/B)
else:
  ans = (A*a)//B - A*math.floor(a/B)

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



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

x = np.arange(1, max(10**6,N+1))
print(int(np.max(np.floor(A*x/B)-A*np.floor(x/B))))

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

if (B == 1):
  print(0)
elif (B > N+1):
  x = N
  print((A*x)//B-A*(x//B))
else:
  x = N-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):
if __name__ == '__main__':
    from sys import stdin
    # from collections import defaultdict
    import math
    input = stdin.readline

    import random

    while True:
        # a, b, n = map(int, input().split())
        a = random.randint(1, 10**6)
        b  = random.randint(1, 10**12)
        n = random.randint(1, 10**12)
        if b > n:
            print(int(math.floor(a*n/b)-a*math.floor(n/b)))
            exit()

        if b >= 10**6:
            ans = 0
            for i in (b-1, n+1, b):
                temp =  math.floor(a*i/b)-a*math.floor(i/b)
                if ans < temp:
                    ans = temp
            print(int(ans))
            exit()

        ans = int(math.floor(a*n/b)-a*math.floor(n/b))
        i = math.floor(n/b)*b-1
        for _ in range(2*10**6):
            temp =  math.floor(a*i/b)-a*math.floor(i/b)
            if ans < temp:
                ans = temp
            i -= b
            if i <= 0:
                print(int(ans))
                exit()
        print(int(ans))





if __name__ == '__main__':
    from sys import stdin
    # from collections import defaultdict
    import math
    input = stdin.readline

    # import random

    a, b, n = map(int, input().split())
    """
    a = random.randint(1, 10**6)
    b  = random.randint(1, 10**6)
    n = random.randint(1, 10**12)
    """
    # print(a, b, n)
    
    if b > n:
        # print('a')
        print(int(math.floor((a*n)/b) - a*math.floor(n/b)))
        exit()
    print(int(math.floor((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):
from math import gcd

a,b,n=map(int,input().split())
t=a*b//gcd(a,b)

ans=[]

for i in range(1,t+1):
    y=int(a*i/b)-a*int(i/b)
    ans.append(y)

n%=t
ans=ans[:t]
print(max(ans))



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

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

print(f(min(n,b-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):
A = int(input())
B = int(input())
N = int(input())
print(int(A*(N-1)/B)-A*int((N-1)/B))

A = int(input())
B = int(input())
N = int(input())
print(int(A*(N-1)/B)-A*int((N-1)/B))

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

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


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

x=min(b-1,n)

print(int(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):
'''
Created on 2020/08/29

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
  A,B,N=map(int,pin().split())
  t=int(B/A)
  ans=0
  for x in range(t,B+1):
    ans=max(ans,int(A*x/B)-A*int(x/B))
  print(ans)
  return 
main()

'''
Created on 2020/08/29

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write

  A,B,N=map(int,pin().split())
  x=min(B-1,N)
  ans=int(A*x/B)-A*int(x/B)
  print(ans)
  return
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 time

def floor(y):
    return int(y)

def main():
    t1 = time.time()

    a, b, n = map(int, input().split())
    ans = [floor(a*x/b) - a*floor(x/b) for x in range(1, n+1)]
    print(max(ans))

    t2 = time.time()

    print(f"経過時間：{t2-t1}")

if __name__ == "__main__":
    main()

import math
a, b, n = map(int, input().split())
x = min(b-1, n)
print(math.floor(a*(x%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=0
print(int(A*(B-1)/B)-A*int((B-1)/B))
if B>=N:
    for i in range(0,10**6):
        x=N-i
        if x<0:
            break
        tmp=int(A*x/B)-A*int(x/B)
        ans=max(ans,tmp)
    #print(ans)
elif B<N:
    for i in range(0,10**6):
        x=N-i
        if x<0:
            break
        tmp=int(A*x/B)-A*int(x/B)
        ans=max(ans,tmp)
    for i in range(0,10**6):
        x=B-i
        if x<0:
            break
        tmp=int(A*x/B)-A*int(x/B)
        ans=max(ans,tmp)
    #print(ans)

A,B,N=map(int,input().split())
ans=0
if B>=N:
    for i in range(0,10**6):
        x=N-i+100
        if x<0:
            break
        tmp=int(A*x/B)-A*int(x/B)
        ans=max(ans,tmp)
    print(ans)
elif B<N:
    for i in range(0,10**6):
        x=N+100-i
        if x<0:
            break
        tmp=int(A*x/B)-A*int(x/B)
        ans=max(ans,tmp)
    for i in range(0,10**6):
        x=B+100-i
        if x<0:
            break
        tmp=int(A*x/B)-A*int(x/B)
        ans=max(ans,tmp)
    print(ans)

A,B,N=map(int,input().split())
if B<=N:
    print(int(A*(B-1)/B)-A*int((B-1)/B))
else:
    print(int(A*(N)/B)-A*int(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):
import math

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


ans1 = 0

x = int(B/A)
while x <= N and x <= B:
    ans = int((A * x) / B) - A * int(x / B)
    print(((A * x) / B), (x / B))
    ans1 = max(ans1, ans)
    x += 1
print(ans1)


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

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_num = 0
num = 0
for i in range(1,N+1):
  if (A*i//B) - A*(i//B) > max_num:
    max_num = (A*i//B) - A*(i//B)
    num = i
    
print(i)

A,B,N = map(int,input().split())
num = min(B-1,N)

print((A*num//B)-A*(num//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):
solved_flag = False
if B==1:
    ans = 0
    solved_flag = True
else:
    if B <= N:
        x = B-1
    else:
        x = N

if not solved_flag:
    ans = math.floor(A*x/B) - A*math.floor(x/B)
print(ans)

import math

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

solved_flag = False
if B==1:
    ans = 0
    solved_flag = True
else:
    if B <= N:
        x = B-1
    else:
        x = N

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

ans = 0
for x in range(B):
  A_x = A * x
  left_ = int(A_x / B)
  right_ = A * int(x / B)
  fnc_ = left_ - right_
  if fnc_ <= N:
    ans = max(ans, fnc_)
    

  # print("     x", x)
  
  # print("right_", right_)
  


print(ans)



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

ans = 0

x = min(N, B-1)

A_x = A * x
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 = map(int,input().split())
x = B-1
a = 0
while x >= (B-1)*9/10:
  if a < A*x//B - A*(x//B):
    a = A*x//B - A*(x//B)
    x -= 1
  else:
    x -= 1
print(a)


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


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


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


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())
ans = max((A*N)//B-A*(N//B),(A*(B-1))//B)
print(ans)

A,B,N = map(int,input().split())
if N >= B-1:
    ans = max((A*N)//B-A*(N//B),(A*(B-1))//B)
else:
    ans = A*N//B - 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):
n, m = map(int, input().split())
count = 0
if n % 2 == 0:
    for i in range(int(n/2)):
        print(i+1, n-i-1)
        count += 1
        if count == m:
            break;
else:
    for i in range(int((n-1)/2)):
        print(i+1, n-i-2)
        count += 1
        if count == m:
            break;

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

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

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

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

ans = f(min(n,b-1))
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 main():
    a,b,n = map(int,input().split())
    if b>n:
        print(int(a*(n/b-n//b)))
    else:
        print(int(a*((b-1)/b))


if __name__ == "__main__":
    main()

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

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

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

import math

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

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

import math

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

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


def main():
    a,b,n = map(int,input().split())
    m = math.floor(a * 0 /b) - a * math.floor(0/b)
    for i in range(1,b):
        if m < math.floor(a * i / b) - a * math.floor(i/b):

            m = math.floor(a * i / b) - a * math.floor(i/b)
    print(m)
if __name__ == "__main__":
    main()


import math


def main():
    a,b,n = map(int,input().split())
    m = math.floor(a * 0 /b) - a * math.floor(0/b)
    for i in range(1,min(b-1,n)+1):
        if m < math.floor(a * i / b) - a * math.floor(i/b):
            m = math.floor(a * i / b) - a * math.floor(i/b)
            break
    print(m)
if __name__ == "__main__":
    main()


import math


def main():
    a,b,n = map(int,input().split())
    # m = math.floor(a * 0 /b) - a * math.floor(0/b)
    
    
    
    i = min(b-1,n)
    m = a*i//b - a*(i//b)
    
    print(m)
if __name__ == "__main__":
    main()


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 = [int(v) for v in input().strip().spilt(" ")]

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

A, B, N = [eval(v) for v in input().strip().split(" ")]

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

def floor(t):
  return math.floor(t)

x = b - 1

max = floor(a * x / b) - a * floor(x / b)
print(max)


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

def floor(t):
  return math.floor(t)

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

max = floor(a * x / b) - a * floor(x / 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):
import math
def equation(a,b,n):
  return math.floor((a*x)/b)-A*math.floor(x/B)
d,e,f = map(int,input().split())
X = equation(d,e,f)
Y = equation(d,e,e-1)
print(max(X,Y))

A,B,N = map(int,input().split())
x = math.gcd(N,B)
K = math.floor(N/B)
if K == 0:
    print(math.floor(A*N/B)-A*math.floor(N/B))
else:
    alpha = B*(K+1)-1
    if alpha > N:
        alpha = N
    print(math.floor(alpha/B)-A*math.floor(alpha/B))

import math
def equation(a,b,n):
  return math.floor((a*n)/b)-a*math.floor(n/b)
d,e,f = map(int,input().split())
K = min(e-1,f)
print(equation(d,e,K))


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

k = n//b

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

print(ans)

import math

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

ans = math.floor(a*min(b-1, 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):
import sys
input = sys.stdin.readline
import numpy as np
import time





def make_table(n, m):
    Table = [None]*n
    for i in range(n):
        rem = np.random.randint(1,m+1)
        Table[i] = rem
    return Table

t0 = time.time()
n, m, q = map(int, input().split())
Lis = [[int(e) for e in input().split()] for _ in range(q)]

Sum_cor = []
for i in range(10000000000):
    if m >=6:
        Table = make_table(n,m)
    else:
        Table = make_table(n,m)
    Table.sort()
    d_sum = 0
    for l in Lis:
        if Table[l[1]-1]-Table[l[0]-1] == l[2]:
            d_sum+=l[3]
    Sum_cor.append(d_sum)
    t1 = time.time()
    if t1-t0 >1.8:
        print(max(Sum_cor))
        break


import sys
input = sys.stdin.readline


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


#f_table = [a*t//b for t in range(b)]

if c >= b:
    print((a * (b-1)) // b)

else:
    x = c
    c_amari = c%b
    c_sho = c//b
    ans =(a * c_amari) //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):
# input
A, B, N = map(int, input().split())

# process
x = 0
if B <= N:
    x = B-1
else:
    x = N

# output
print(x)
print(A*x//B - A*(x//B))


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

# process
x = 0
if B <= N:
    x = B-1
else:
    x = N

# output
print(A*x//B - 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):
a,b,n=map(int,input().split())
score=0
if (n<b):
    print( int(a*n/b))
elif(b＝＝１):
    print(0)
else:
    c = int(n/b)
    score = 0
    for i in range(1,c+1):
        n_ = b*i-1
        t = int(a*n_/b)-a*int(n_/b)
        score = max(score,t)
    t = int(a*n/b)-a*int(n/b)
    score = max(score,t)
    print(score)

a,b,n=map(int,input().split())
score=0
if (n<b):
    print( int(a*n/b))
elif(b==1):
    print(0)
else:
    c = int(n/b)
    score = 0
    for i in range(1,c+1):
        n_ = b*i-1
        t = int(a*n_/b)-a*int(n_/b)
        score = max(score,t)
    t = int(a*n/b)-a*int(n/b)
    score = max(score,t)
    print(score)

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

if b >= n:
    t = int(a * n / b) - a * int(n/b)
    for i in range(100000):
        t_ = int(a * (n+i) / b) - a * int((n+i)/b)
        if t_ > t:
            t = t_
else:
    t = int(a * n / b) - a * int(n/b)
    
print(t)

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

if b > n:
    t = int(a * n / b) - a * int(n/b)
else:
    x = b-1
    t = int(a * x / b) - a * int(x/b)
    
print(t)

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())
max_num = -10**100
tmp_num = 0
cnt = 1
flg = False
while flg  == False:
  tmp_num = math.floor(A*cnt/B) - A*math.floor(cnt/B)
  #print(tmp_num)
  if tmp_num > max_num :
    max_num = tmp_num
    cnt += 1
  else:
    flg = True
print(max_num)

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

max_score = 0
y = a // b
for x in range(y - 100, y + 200):
    score = a * x // b - a * ( x // b )
    if score > max_score:
        max_score = score
print(max_score)


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

max_score = 0
y = min(b, n)

for x in range(max(y - 100000, 1) , min(y + 200000, n+1)):
    score = a * x // b - a * ( x // b )
    if score > max_score:
        max_score = score
print(max_score)


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


a,b,n = (int(i) for i in input().split())


ans = b-1



print(ans)


import sys


a,b,n = (int(i) for i in input().split())


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

else:
    ans = ((b-1)*a)//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):
list=input().split(" ")
A=int(list[0])
B=int(list[1])
N=int(list[2])

if B>N:
    B=N-1

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

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

if N>=B:
    N=B-1

print(int(A*N/B) - 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())

#c=[0]*N
s=0
print(max(N,(A*N)//B-A*(N//B)))

exit
for i in range(1,N+1):
  if s<(A*i)//B-A*(i//B):
    s=(A*i)//B-A*(i//B)

print(s)

A,B,N=map(int,input().split())
#if B==1:print(0);exit()
if N>=B:print((A*(B-1))//B)
else:
  print((A*N)//B-A*(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):

def resolve():
    def f(x):
        res = (A*x)//B - A*(x//B)
        return res

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

if __name__ == "__main__":
    resolve():


def resolve():
    def f(x):
        res = (A*x)//B - A*(x//B)
        return res

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

if __name__ == "__main__":
    resolve()

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):
#!/usr/bin/python3

import math

input_1 = input()
a = int(input_1.split(" ")[0])
b = int(input_1.split(" ")[1])
n = int(input_1.split(" ")[2])



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

#!/usr/bin/python3

import math

input_1 = input()
a = int(input_1.split(" ")[0])
b = int(input_1.split(" ")[1])
n = int(input_1.split(" ")[2])



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

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())
s=0
x=1
mf=math.floor
while True:
    q=mf(A*x/B)-A*mf(x/B)
    if s<=q:
        s=q
        #print(q)
        x=x+1
        continue
    if s>q:
        print(s)
        break

import math
A,B,N = map(int, input().split())
s=0
x=1
mf=math.floor
while True:
    q=mf(A*x/B)-A*mf(x/B)
    if s<=q:
        s=q
        print(q)
        x=x+1
        continue
    if s>q:
        print(s)
        break


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

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

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

import math
a,b,n = map(int,input().split())
c = n // b * b - 1
ans = max(math.floor(a * c / b) - a * math.floor(c / b), math.floor(a * n / b) - a * math.floor(n / b))

print(ans)

a,b,n = map(int,input().split())
c = n // b * b
ans=0
if n > b - 1:
    ans = math.floor(a * c / b) - a * math.floor(c / b)

else:
    
        #print(i+1)
        #print(math.floor(a * (i+1) / b) - a * math.floor((i+1) / b))
        #if math.floor(a * (i+1) / b) - a * math.floor((i+1) / b) > ans:
        #    ans = math.floor(a * (i+1) / b) - a * math.floor((i+1) / b)
    ans = math.floor(a * n / b) - a * math.floor(n / b)
print(ans)
    

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


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

import math
a,b,n = map(int,input().split())
c = max(0,n // b * b - 1)
ans = mmath.floor(a * n / b) - a * math.floor(n / b)
 
print(ans)


print(0)

import math
a,b,n = map(int,input().split())
c = max(0,n // b * b - 1)
ans = mmath.floor(a * c / b) - a * math.floor(c / b)
 
print(ans)

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

Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

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

A, B, N = map(int, input().split())
print(A*min(B-1, 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):
a,b,n = map(int,input().split())
print(min(n,b-1)/b*a)

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

y = 0

for x in range(1,n+1):
    if x%b!=0:
        temp = ((a*x)//b) - a*(x//b)
    else:
        temp = 0
    if y < temp:
        y = temp
        ans = x
    
print(ans)

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

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

ans=-100000
for x in range(A):
  
  ans=max(ans,(A*x//B)-A*(x//B))
  if x==N:break
x=B-1
if x>N:x=N
ans=max(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):
import math
a,b,n=map(int,input().split())
max=0
pre=0
if b//a==0:
    st=1
else:
    st=b//a
check=0
for i in range(0,n+1,st):
    f=math.floor(a*i/b)-a*math.floor(i/b)
    if f>=max:
        max=f
    if f==0:
        check+=1
    if check>st:
        break

print(max)


import math
a,b,n=map(int,input().split())
max=0
pre=0
if b//a-1<=0:
    st=1
else:
    st=b//a-1
check=0
for i in range(0,n+1,st):
    f=math.floor(a*i/b)-a*math.floor(i/b)
    if f>max:
        max=f
    if f==0:
        check+=1
    if check>st+2:
        break
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):
# D

inp = input().split(' ')
A, B, N = int(inp[0]), int(inp[1]), int(inp[2])

alpha, beta = math.floor(A/B), A%B
if B-1 < N:
    x = B-1
else:
    x = N
    
print(math.floor(A*x/B) - A * math.floor(x/B))

# D

import math
inp = input().split(' ')
A, B, N = int(inp[0]), int(inp[1]), int(inp[2])

alpha, beta = math.floor(A/B), A%B
if B-1 < N:
    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):
from math import floor
A, B, N = map(int,input().split())

x=0
pre=floor(A*x/B)-A*floor(x/B)
max_x=0
max_i=pre

while True:
	x +=1
	cur=floor(A*x/B)-A*floor(x/B)
	
	if (cur < pre)and(x<=N):
		print(x-1)
		break
	elif(x>N):
		print(max_x)
		break
	else:
		if max_i < cur:
			max_i = cur
			max_x = x
		pre = cur

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

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

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

x=min(N,B-1)
print(floor(A*x/B)-A*floor(x/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):
import math
A, B, N = list(map(int, input().split()))
minx = min([B-1, N])
print(math.floor(A*minx/B) - A*math.floor(minx*B))

import math
A, B, N = list(map(int, input().split()))
minx = min([B-1, N])
print(math.floor(A*minx/B) - A*math.floor(minx/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-1:
    result = B-1
else:
    result = N
    
print(result)

A, B, N = map(int, input().split())
if N >= B-1:
    result = B-1
else:
    result = N
    
print(min(B-1, N))

A, B, N = map(int, input().split())
if B == 1:
    result = 0
elif N >= B-1:
    result = B-1
else:
    result = N
    
print(result)

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

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

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

c = min(b - 1, n)


print(((a * c) / b) // 1 - (a * ((c / b) // 1)))

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

c = min(b - 1, n)

print(int(((a * c) / b) // 1 - (a * ((c / b) // 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):
import math

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

max = 0
for i in range(B):
    value = math.floor(A*i/B) - A*math.floor(i/B)
    if value > max:
        max=value
print(max)


import math

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

def f(x):
    return math.floor(A*x/B) - A*math.floor(x/B)
print(f(min(N,B-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):
a,b,n = map(int,input().split())
#if b%n != 0:
	#print((a*n)//b - ((n//b)*a))
#else:
n = b-1
print((a*n)//b - ((n//b)*a))
	

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

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

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

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

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

import math

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

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

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

x1 = N
x3 = min(N,B-1)
def f(x): 
    t = math.floor((A*x)/B) - A * math.floor(x/B)
    return int(t)
print(max(f(x1),f(x3)))
print(max(3,3,2))

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

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())
sumtemp=0
summax=0
for x in range(1,b):
    sumtemp=int(a*x/b)-a*int(x/b)
    if sumtemp>summax:
        summax=sumtemp
print(sumtemp)

a,b,n = map(int, input().split())
sumtemp=0
summax=0
for x in range(1,n+1-b):
    sumtemp=int(a*x/b)-a*int(x/b)
    if sumtemp>summax:
        summax=sumtemp
print(sumtemp)

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

Verdicts: Wrong Answer

Wrong Answer

Accepted