Problem:


Score : 400 points

Problem Statement

Given are integers A, B, and N.

Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non-negative integer x not greater than N.

Here floor(t) denotes the greatest integer not greater than the real number t.

Constraints

1 ≤ A ≤ 10^{6}

1 ≤ B ≤ 10^{12}

1 ≤ N ≤ 10^{12}

All values in input are integers.

Input

Input is given from Standard Input in the following format:

A B N

Output

Print the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non-negative integer x not greater than N, as an integer.

Sample Input 1

5 7 4

Sample Output 1

2

When x=3, floor(Ax/B)-A×floor(x/B) = floor(15/7) - 5×floor(3/7) = 2. This is the maximum value possible.

Sample Input 2

11 10 9

Sample Output 2

9



Sample input:
5 7 4


Sample output:
2

Submission status: Wrong Answer

Solution code:
import math
import sys
x=input()
x0=x.split()
a=int(x0[0])
b=int(x0[1])
n=int(x0[2])
b0=n%b
b1=0
if b==1:
    print(0)
    sys.exit()
for i in range(math.floor(n/b)+1):
    if b*(i-1)>n:
        b1=b*(i-1)-1
        break
q1=math.floor(a*b0/b)-a*math.floor(b0/b)
q2=math.floor(a*b1/b)-a*math.floor(b1/b)
print(max(q1,q2))

Submission status: Wrong Answer

Solution code:
import math
import sys
x=input()
x0=x.split()
a=int(x0[0])
b=int(x0[1])
n=int(x0[2])
b0=n%b
b1=0
if b==1:
    print(0)
    sys.exit()
for i in range(math.floor(n/b)+1):
    if b*i-1>n:
        b1=b*(i-1)-1
        break
q1=math.floor(a*b0/b)-a*math.floor(b0/b)
q2=math.floor(a*b1/b)-a*math.floor(b1/b)
print(max(q1,q2))

Submission status: Wrong Answer

Solution code:
import math
x=input()
x0=x.split()
a=int(x0[0])
b=int(x0[1])
n=int(x0[2])
b0=n%b
b1=0
for i in range(math.floor(n/b)+1):
    if b*i-1>n:
        b1=b*(i-1)-1
        break
q1=math.floor(a*b0/b)-a*math.floor(b0/b)
q2=math.floor(a*b1/b)-a*math.floor(b1/b)
print(max(q1,q2))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from math import floor

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

ans=A-1

m=0
if N<B:
    an=A*N
    for i in range(int(an/B+2)):
        if an > B:
            an-=B
            m+=1
        else:
            break
    ans=m
if B==1:
    ans=0
print(ans)

Submission status: Wrong Answer

Solution code:
from math import floor

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

ans=A-1

m=0
if N<B:
    an=A*N
    for i in range(int(an/B+2)):
        if an > B:
            an-=B
            m+=1
        else:
            break
    ans=m
print(ans)

Submission status: Wrong Answer

Solution code:
from math import floor

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

ans=A-1

m=0
if N<B:
    an=A*N
    for i in range(int(an/B+1)):
        if an > B:
            an-=B
            m+=1
        else:
            break
    ans=m
print(ans)

Submission status: Wrong Answer

Solution code:
from math import floor
import decimal

A,B,N=input().split()
a=decimal.Decimal(A)
b=decimal.Decimal(B)
n=decimal.Decimal(N)

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

Submission status: Wrong Answer

Solution code:
from math import floor

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

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

Submission status: Wrong Answer

Solution code:
from math import floor

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

ans=floor(min(A*N/B, A-1))
print(ans)

Submission status: Wrong Answer

Solution code:
from math import floor

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

ans=floor(min(A*N/B, A))
print(ans)

Submission status: Wrong Answer

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

if(N > B):
  x = B - 1
else:
  x = N

'''
print(x)
'''

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

Submission status: Wrong Answer

Solution code:
from math import floor
a, b, n = map(int, input().split())
ans = 0
for i in range(min(10**6, n)):
    score = floor(a*(n-i)/b) - a*floor((n-i)/b)
    ans = max(score, ans)
print(ans)

Submission status: Wrong Answer

Solution code:
from math import floor
a, b, n = map(int, input().split())
ans = 0
for i in range(min(5, n)):
    score = floor(a*(n-i)/b) - a*floor((n-i)/b)
    ans = max(score, ans)
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a, b, n = map(int, input().split())
ans1 = 0
for i in range(n+1):
  ans2 = int(a * i / b) - a * int(i / b)
  ans1 = max(ans1, ans2)
  if ans1 == ans2:
    x = i
print(x)

Submission status: Wrong Answer

Solution code:
from math import floor

def main():
    nums = list(map(int, input().split()))
    a, b, n = nums[0], nums[1], nums[2]

    def f(x):
        nonlocal a, b, n
        if x < 1 or x > n:
            return -100000
        
        g = floor(a * x / b)
        h = a * floor(x / b)
        res = g - h
        return res
    
    lo, hi = 1, n
    ans = -100000
    while lo <= hi:
        mid = (lo + hi) // 2
        m = f(mid)
        p = f(mid - 1)
        q = f(mid + 1)
        if m > p and m > q:
            ans = max(ans, m)
            break
        elif p > m:
            hi = mid - 1
        elif q > m:
            lo = mid + 1
        else:
            ans = max(ans, m)
            hi = mid - 1

    while lo <= hi:
        mid = (lo + hi) // 2
        m = f(mid)
        p = f(mid - 1)
        q = f(mid + 1)
        if m > p and m > q:
            ans = max(ans, m)
            break
        elif p > m:
            hi = mid - 1
        elif q > m:
            lo = mid + 1
        else:
            ans = max(ans, m)
            lo = mid + 1

    print(ans)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

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

m = 0
for i in range(1,N+1):
#     print(i,m)
    if m < f(A,B,i):
        m = f(A,B,i)

print(m)

Submission status: Wrong Answer

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


if B < N:
    Max = int(A*(B-1)/B)
    X = int(N/B)
    fx = int(A*(B*X-1)/B) - A * int((B*X-1)/B)
    Max = max(fx,Max)
    # for x in range(1,X):
    #     fx = int(A*x/B) - A * int(x/B)
    #     Max = max(Max,fx)
elif B == N:
    Max = int(A*(B-1)/B)
else:
    Max = int(A*N/B)
print(Max)

Submission status: Wrong Answer

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

if B < N:
    Max = int(A*(B-1)/B)
    for x in range(B,1+N):
        fx = int(A*x/B) - A * int(x/B)
        Max = max(Max,fx)
elif B == N:
    Max = 0
else:
    Max = int(A*N/B)
print(Max)

Submission status: Wrong Answer

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

if B < N:
    Max = int(A*N/B) - A * int(N/B)
    for x in range(B,1+N):
        fx = int(A*x/B) - A * int(x/B)
        Max = max(Max,fx)
# elif B == N:
#     Max = 0
else:
    Max = int(A*N/B) - A * int(N/B)
print(Max)

Submission status: Wrong Answer

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

if B < N:
    Max = A
    for x in range(B,1+N):
        fx = int(A*x/B) - A * int(x/B)
        Max = max(Max,fx)
# elif B == N:
#     Max = 0
else:
    Max = int(A*N/B) - A * int(N/B)
print(Max)

Submission status: Wrong Answer

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

if B < N:
    Max = A
    for x in range(B,1+N):
        fx = int(A*x/B) - A * int(x/B)
        Max = max(Max,fx)
elif B == N:
    Max = 0
else:
    Max = int(A*N/B) - A * int(N/B)
print(Max)

Submission status: Wrong Answer

Solution code:
import math

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A,B,N = map(int,input().split())
q = A * N
t = int(q / B)
m = q % B
x = int(m / N)
ans = t - A * int(x / B)
print(ans)

Submission status: Wrong Answer

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

ans = []

for cnt, i in enumerate(range(N//B+1, 1, -1)):
    ans.append(f(B*i-1))
    if cnt >= 100:
        break
ans.append(f(N))
ans.append(f(1))
#print(f(N))
print(max(ans))

Submission status: Wrong Answer

Solution code:

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

ans = []
for i in range(0, N//B+1):
    ans.append(f(B*i-1))
ans.append(f(N))
#print(f(N))
print(max(ans))

Submission status: Wrong Answer

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

ans = 0
for i in range(0, N//B+1):
    ans = max(ans, f(B*i-1))
ans = max(ans, f(N))
#print(f(N))
print(ans)

Submission status: Wrong Answer

Solution code:
A,B,N=map(int,input().split())
import math
def f(x):
    return math.floor(A*x/B) - a*math.floor(x/B)

a = 0
for i in range(0, N//B+1):
    a = max(a, f(B*i-1))
a = max(a, f(N))
#print(f(N))
print(a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
from math import floor

def parse():
  return map(int, input().split(" "))

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

  limit_N = 1000000
  N = limit_N if N > limit_N else N

  x = 0
  max_val = floor((A * x) / B) - A * floor(x / B)

  for x in range(1, N + 1):
    val = floor((A * x) / B) - A * floor(x / B)
    if max_val < val:
      max_val = val

  print(max_val)

if __name__ == "__main__":
  main()

Submission status: Wrong Answer

Solution code:

from math import floor

def parse():
  return map(int, input().split(" "))

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

  limit_N = 100000
  N = limit_N if N > limit_N else N

  x = 0
  max_val = floor((A * x) / B) - A * floor(x / B)

  for x in range(1, N + 1):
    val = floor((A * x) / B) - A * floor(x / B)
    if max_val < val:
      max_val = val

  print(max_val)

if __name__ == "__main__":
  main()

Submission status: Wrong Answer

Solution code:

from math import floor

def parse():
  return map(int, input().split(" "))

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

  limit_N = 10000
  N = limit_N if N > limit_N else N

  x = 0
  max_val = floor((A * x) / B) - A * floor(x / B)

  for x in range(1, N + 1):
    val = floor((A * x) / B) - A * floor(x / B)
    if max_val < val:
      max_val = val

  print(max_val)

if __name__ == "__main__":
  main()

Submission status: Wrong Answer

Solution code:
from sys import stdin
input = stdin.readline
 
a,b,n = map(int,input().split())
maxpoint = 0
 
if b > n  :
    tmp = int((a * n) / b)  - a * int(n/b) 
    maxpoint = max(tmp,maxpoint)
else:
    k = int(n/b)*b -1
    maxpoint =  int((a * k) / b)  - a * int(k/b) 
    # print(k)
    # for i in reversed(range(n+1)):
    #     t1 =  int((a * i) / b)  - a * int(i/b) 
    #     if t1 > k :
    #         print("koeta")
        # if b > 1:
        #     if i % (b-1) == 0 :
        #         maxpoint = max(tmp,maxpoint)
        #         print(maxpoint) 
        #         exit()
        # elif b == 1:
        #     print(0)
        #     exit()
        # maxpoint = max(t1,maxpoint)
    # tmp = int((a * n) / b)  - a * int(n/b) 
    # k = int(n/b)*b -1
    # k =  int((a * k) / b)  - a * int(k/b) 
    # maxpoint = max(tmp,k)
    # t2 = int((a * b-1) / b)  - a * int(b-1/b) 
    # maxpoint = max(t1,t2)
 
print(maxpoint)

Submission status: Wrong Answer

Solution code:

from sys import stdin
input = stdin.readline

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

if b > n  :
    tmp = int((a * n) / b)  - a * int(n/b) 
    maxpoint = max(tmp,maxpoint)
elif b == n:
    maxpoint = 0
else:
    # tmp = int((a * n) / b)  - a * int(n/b) 
    k = int(n/b)*b -1
    # t1 =  int((a * k) / b)  - a * int(k/b) 
    # print(tmp,t1,k)
    # maxpoint = max(t1,tmp)
    for i in reversed(range(n+1)):
        t1 =  int((a * i) / b)  - a * int(i/b) 
        if b > 1:
            if i == k :
                maxpoint = max(t1,maxpoint)
                print(maxpoint) 
                exit()
        elif b == 1:
            print(0)
            exit()
        if t1 > maxpoint:
            print(t1)
            maxpoint = t1
       

print(maxpoint)

Submission status: Wrong Answer

Solution code:

from sys import stdin
input = stdin.readline

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

if b > n  :
    tmp = int((a * n) / b)  - a * int(n/b) 
    maxpoint = max(tmp,maxpoint)
elif b == n:
    maxpoint = 0
else:
    tmp = int((a * n) / b)  - a * int(n/b) 
    k = int(n/b)*b -1
    t1 =  int((a * k) / b)  - a * int(k/b) 
    # print(tmp,t1,k)
    maxpoint = max(t1,tmp)
    for i in reversed(range(n+1)):
        t1 =  int((a * i) / b)  - a * int(i/b) 
        if b > 1:
            if i == k :
                print(maxpoint) 
                exit()
        elif b == 1:
            print(0)
            exit()
        if t1 > maxpoint:
            print(t1)
            maxpoint = t1
       

print(maxpoint)

Submission status: Wrong Answer

Solution code:

from sys import stdin
input = stdin.readline

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

if b > n  :
    tmp = int((a * n) / b)  - a * int(n/b) 
    maxpoint = max(tmp,maxpoint)
    print('g')
    exit()
elif b == n:
    maxpoint = 0
else:
    tmp = int((a * n) / b)  - a * int(n/b) 
    k = int(n/b)*b -1
    t1 =  int((a * k) / b)  - a * int(k/b) 
    maxpoint = max(t1,tmp)
    # for i in reversed(range(n+1)):
    #     t1 =  int((a * i) / b)  - a * int(i/b) 
    #     if b > 1:
    #         if i == k :
    #             print(maxpoint) 
    #             exit()
    #     elif b == 1:
    #         print(0)
    #         exit()
    #     if t1 > maxpoint:
    #         maxpoint = t1
       
    
    # print(tmp)
   
    # print(k)
    
    # maxpoint = max(tmp,k)
    

print(maxpoint)

Submission status: Wrong Answer

Solution code:

from sys import stdin
input = stdin.readline

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

if b > n  :
    tmp = int((a * n) / b)  - a * int(n/b) 
    maxpoint = max(tmp,maxpoint)
    print('g')
elif b == n:
    maxpoint = 0
else:
    tmp = int((a * n) / b)  - a * int(n/b) 
    k = int(n/b)*b -1
    t1 =  int((a * k) / b)  - a * int(k/b) 
    maxpoint = max(t1,tmp)
    # for i in reversed(range(n+1)):
    #     t1 =  int((a * i) / b)  - a * int(i/b) 
    #     if b > 1:
    #         if i == k :
    #             print(maxpoint) 
    #             exit()
    #     elif b == 1:
    #         print(0)
    #         exit()
    #     if t1 > maxpoint:
    #         maxpoint = t1
       
    
    # print(tmp)
   
    # print(k)
    
    # maxpoint = max(tmp,k)
    

print(maxpoint)

Submission status: Wrong Answer

Solution code:

from sys import stdin
input = stdin.readline

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

if b > n  :
    tmp = int((a * n) / b)  - a * int(n/b) 
    maxpoint = max(tmp,maxpoint)
    print(0)
elif b == n:
    maxpoint = 0
else:
    tmp = int((a * n) / b)  - a * int(n/b) 
    k = int(n/b)*b -1
    t1 =  int((a * k) / b)  - a * int(k/b) 
    maxpoint = max(t1,tmp)
    # for i in reversed(range(n+1)):
    #     t1 =  int((a * i) / b)  - a * int(i/b) 
    #     if b > 1:
    #         if i == k :
    #             print(maxpoint) 
    #             exit()
    #     elif b == 1:
    #         print(0)
    #         exit()
    #     if t1 > maxpoint:
    #         maxpoint = t1
       
    
    # print(tmp)
   
    # print(k)
    
    # maxpoint = max(tmp,k)
    

print(maxpoint)

Submission status: Wrong Answer

Solution code:

from sys import stdin
input = stdin.readline

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

if b > n  :
    tmp = int((a * n) / b)  - a * int(n/b) 
    maxpoint = max(tmp,maxpoint)
elif b == n:
    maxpoint = 0
else:
    tmp = int((a * n) / b)  - a * int(n/b) 
    k = int(n/b)*b -1
    t1 =  int((a * k) / b)  - a * int(k/b) 
    maxpoint = max(t1,tmp)
    # for i in reversed(range(n+1)):
    #     t1 =  int((a * i) / b)  - a * int(i/b) 
    #     if b > 1:
    #         if i == k :
    #             print(maxpoint) 
    #             exit()
    #     elif b == 1:
    #         print(0)
    #         exit()
    #     if t1 > maxpoint:
    #         maxpoint = t1
       
    
    # print(tmp)
   
    # print(k)
    
    # maxpoint = max(tmp,k)
    

print(maxpoint)

Submission status: Wrong Answer

Solution code:

from sys import stdin
input = stdin.readline

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

if b > n  :
    tmp = int((a * n) / b)  - a * int(n/b) 
    maxpoint = max(tmp,maxpoint)
elif b == n:
    maxpoint = 0
else:
    tmp = int((a * n) / b)  - a * int(n/b) 
    k = int(n/b)*b -1
    t1 =  int((a * k) / b)  - a * int(k/b) 
    maxpoint = max(t1,tmp)
    for i in reversed(range(n+1)):
        t1 =  int((a * i) / b)  - a * int(i/b) 
        if b > 1:
            if i == k :
                print(maxpoint) 
                exit()
        elif b == 1:
            print(0)
            exit()
        if t1 > maxpoint:
            maxpoint = t1
       
    
    # print(tmp)
   
    # print(k)
    
    # maxpoint = max(tmp,k)
    

print(maxpoint)

Submission status: Wrong Answer

Solution code:

from sys import stdin
input = stdin.readline

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

if b > n  :
    tmp = int((a * n) / b)  - a * int(n/b) 
    maxpoint = max(tmp,maxpoint)
elif b == n:
    maxpoint = 0
else:
    # for i in reversed(range(n+1)):
    #     t1 =  int((a * n) / b)  - a * int(n/b) 
    #     if b > 1:
    #         if i % (b-1) == 0 :
    #             maxpoint = max(tmp,maxpoint)
    #             print(maxpoint) 
    #             exit()
    #     elif b == 1:
    #         print(0)
    #         exit()
    #     maxpoint = max(tmp,maxpoint)
    tmp = int((a * n) / b)  - a * int(n/b) 
    k = int(n/b)*b -1
    k =  int((a * k) / b)  - a * int(k/b) 
    maxpoint = max(tmp,k)
    # t2 = int((a * b-1) / b)  - a * int(b-1/b) 
    # maxpoint = max(t1,t2)

print(maxpoint)

Submission status: Wrong Answer

Solution code:
from sys import stdin
input = stdin.readline

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

if b > n  :
    tmp = int((a * n) / b)  - a * int(n/b) 
    maxpoint = max(tmp,maxpoint)
elif b == n:
    maxpoint = 0
else:
    for i in reversed(range(n+1)):
        tmp = int((a * i) / b)  - a * int(i/b) 
        if b > 1:
            if i % (b-1) == 0 :
                maxpoint = max(tmp,maxpoint)
                print(maxpoint) 
                exit()
        elif b == 1:
            print(0)
            exit()
    #     maxpoint = max(tmp,maxpoint)
    # t1 =  int((a * n) / b)  - a * int(n/b) 
    # t2 = int((a * b-1) / b)  - a * int(b-1/b) 
    # maxpoint = max(t1,t2)

print(maxpoint)

Submission status: Wrong Answer

Solution code:

from sys import stdin
input = stdin.readline

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

if b > n  :
    tmp = int((a * n) / b)  - a * int(n/b) 
    maxpoint = max(tmp,maxpoint)
elif b == 0:
    maxpoint = 0
else:
    # for i in reversed(range(n+1)):
    #     tmp = int((a * i) / b)  - a * int(i/b) 
    #     if b > 1:
    #         if i % (b-1) == 0 :
    #             maxpoint = max(tmp,maxpoint)
    #             print(maxpoint) 
    #             exit()
    #     elif b == 1:
    #         print(0)
    #         exit()
    #     maxpoint = max(tmp,maxpoint)
    t1 =  int((a * n) / b)  - a * int(n/b) 
    t2 = int((a * b-1) / b)  - a * int(b-1/b) 
    maxpoint = max(t1,t2)

print(maxpoint)

Submission status: Wrong Answer

Solution code:

from sys import stdin
input = stdin.readline

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

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

elif n > 100000:
    for i in range(n-99999,n+1):
        tmp = int((a * i) / b)  - a * int(i/b) 
        maxpoint = max(tmp,maxpoint)
else:
    for i in reversed(range(n+1)):
        tmp = int((a * i) / b)  - a * int(i/b) 
        if b > 1:
            if i % (b-1) == 0 :
                maxpoint = max(tmp,maxpoint)
                print(maxpoint) 
                exit()
        elif b == 1:
            print(0)
            exit()
        maxpoint = max(tmp,maxpoint)

print(maxpoint)

Submission status: Wrong Answer

Solution code:
from sys import stdin
input = stdin.readline

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

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

elif n > 10000:
    for i in range(n-9999,n+1):
        tmp = int((a * i) / b)  - a * int(i/b) 
        maxpoint = max(tmp,maxpoint)
else:
    for i in reversed(range(n+1)):
        tmp = int((a * i) / b)  - a * int(i/b) 
        if b > 1:
            if i % (b-1) == 0 :
                maxpoint = max(tmp,maxpoint)
                print(maxpoint) 
                exit()
        elif b == 1:
            print(0)
            exit()
        maxpoint = max(tmp,maxpoint)

print(maxpoint)

Submission status: Wrong Answer

Solution code:
from sys import stdin
input = stdin.readline

a,b,n = map(int,input().split())
maxpoint = 0
c = 0
if b > n :
    for i in range(n+1):
        tmp = int((a * i) / b)  - a * int(i/b) 
        maxpoint = max(tmp,maxpoint)
        c += 1
        if c == 1000000:
            print(maxpoint)
            exit()
else:
    for i in reversed(range(n+1)):
        c += 1
        tmp = int((a * i) / b)  - a * int(i/b) 
        if b > 1:
            if i % (b-1) == 0 :
                maxpoint = max(tmp,maxpoint)
                print(maxpoint) 
                exit()
        elif b == 1:
            print(0)
            exit()
        maxpoint = max(tmp,maxpoint)
        if c == 1000000:
            print(maxpoint)
            exit()
        # print(maxpoint)

print(maxpoint)

Submission status: Wrong Answer

Solution code:

from sys import stdin
input = stdin.readline

a,b,n = map(int,input().split())
maxpoint = 0
c = 0
if b > n :
    for i in range(n+1):
        tmp = int((a * i) / b)  - a * int(i/b) 
        maxpoint = max(tmp,maxpoint)
        c += 1
        if c == 100000:
            print(maxpoint)
            exit()
else:
    for i in reversed(range(n+1)):
        c += 1
        tmp = int((a * i) / b)  - a * int(i/b) 
        if b > 1:
            if i % (b-1) == 0 :
                maxpoint = max(tmp,maxpoint)
                print(maxpoint) 
                exit()
        elif b == 1:
            print(0)
            exit()
        maxpoint = max(tmp,maxpoint)
        if c == 100000:
            print(maxpoint)
            exit()
        # print(maxpoint)

print(maxpoint)

Submission status: Wrong Answer

Solution code:

from sys import stdin
input = stdin.readline

a,b,n = map(int,input().split())
maxpoint = 0
c = 0
if b > n :
    for i in range(n+1):
        tmp = int((a * i) / b)  - a * int(i/b) 
        maxpoint = max(tmp,maxpoint)
        c += 1
        if c == 30000:
            print(maxpoint)
            exit()
else:
    for i in reversed(range(n+1)):
        c += 1
        tmp = int((a * i) / b)  - a * int(i/b) 
        if b > 1:
            if i % (b-1) == 0 :
                maxpoint = max(tmp,maxpoint)
                print(maxpoint) 
                exit()
        elif b == 1:
            print(0)
            exit()
        maxpoint = max(tmp,maxpoint)
        if c == 30000:
            print(maxpoint)
            exit()
        # print(maxpoint)

print(maxpoint)

Submission status: Wrong Answer

Solution code:

from sys import stdin
input = stdin.readline

a,b,n = map(int,input().split())
maxpoint = 0
c = 0
if b > n:
    for i in range(n+1):
        tmp = int((a * i) / b)  - a * int(i/b) 
        maxpoint = max(tmp,maxpoint)
        c += 1
        if c == 10000:
            print(maxpoint)
            exit()
else:
    for i in reversed(range(n+1)):
        c += 1
        tmp = int((a * i) / b)  - a * int(i/b) 
        if b > 1:
            if i % (b-1) == 0 :
                maxpoint = max(tmp,maxpoint)
                print(maxpoint) 
                exit()
        elif b == 1:
            print(0)
            exit()
        maxpoint = max(tmp,maxpoint)
        if c == 10000:
            print(maxpoint)
            exit()
        # print(maxpoint)

print(maxpoint)

Submission status: Wrong Answer

Solution code:
from sys import stdin
input = stdin.readline

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

maxpoint = 0

for i in reversed(range(n+1)):
    tmp = int((a * i) / b)  - a * int(i/b) 
    if b > 1:
        if i % (b-1) == 0 :
            print(tmp) 
            exit()
    elif b == 1:
        print(0)
        exit()
    maxpoint = max(tmp,maxpoint)
print(maxpoint)

Submission status: Wrong Answer

Solution code:

from sys import stdin
input = stdin.readline

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

maxpoint = 0
if b > n:
    k = n
else:
    k = b
for i in range(k):
    tmp = int((a * n) / b)  - a * int(n/b) 
    maxpoint = max(tmp,maxpoint)
    n = n-1

print(maxpoint)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from math import floor

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

Submission status: Wrong Answer

Solution code:
from math import floor

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

Submission status: Wrong Answer

Solution code:
from math import floor

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

Submission status: Wrong Answer

Solution code:
import math
a = 0
b = 0

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

a,b,n = map(int,input().split())
if n < b:
    ans = f(n)
else:
    q,mod = divmod(n,b)
    cn = (q-1)*b+b-1 
    ans = f(cn)
    ans = max(ans,f(n))
print(ans)

Submission status: Wrong Answer

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

x = N

if N >= B-1:
    x = B-1

ans = A * x/B - A * (x/B)

print(ans)

Submission status: Wrong Answer

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

left=1
right=n
for _ in range(100):
    delta=(right-left)/3
    midl=left+delta
    midr=midl+delta
#    print(f'left={left} midl={midl} midr={midr} right={right}')
    if f(midl)>f(midr):
        right=midr
    else:
        left=midl
print(int(f(midl)))

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

def main():
    a, b, n = map(int, readline().split())
    print(min(f(n, a, b), f(b-1, a, b)))
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from math import floor
from sys import stdin
A, B, N = [int(_) for _ in stdin.readline().rstrip().split()]
def solve(x):
    return floor(A*x/B)-A*floor(x/B)
print(solve(N))

Submission status: Wrong Answer

Solution code:
A,B,N = map(int,input().split())
ans = []
if N < 15:
    for x in range(N+1):
        tmp = (A * x // B) - A * (x//B)
        ans.append(tmp)
        #print(tmp)
else:
    for x in range(N-1000,N+1):
        tmp = (A * x // B) - A * (x//B)
        ans.append(tmp)
        #print(tmp)
print(max(ans))

Submission status: Wrong Answer

Solution code:
A,B,N = map(int,input().split())
ans = []
if N < 15:
    for x in range(N+1):
        tmp = (A * x // B) - A * (x//B)
        ans.append(tmp)
        #print(tmp)
else:
    for x in range(N-100000,N+1):
        tmp = (A * x // B) - A * (x//B)
        ans.append(tmp)
        #print(tmp)
print(max(ans))

Submission status: Wrong Answer

Solution code:
A,B,N = map(int,input().split())
ans = []
if N < 15:
    for x in range(N+1):
        tmp = (A * x // B) - A * (x//B)
        ans.append(tmp)
        #print(tmp)
else:
    for x in range(N-10,N+1):
        tmp = (A * x // B) - A * (x//B)
        ans.append(tmp)
        #print(tmp)
print(max(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from math import floor

A,B,N = map(int,input().split())
i = 0
x = 0.1
f_N =floor(A*N/B)-A*floor(N/B)
while i<N:
    f_i = floor(A*i/B)-A*floor(i/B)
    f_i_1 = floor(A * (i+1) / B) - A * floor((i+1) / B)
    f_N =floor(A*N/B)-A*floor(N/B)
    #print(f_i,f_i_1)
    if f_i_1 - f_i <= 0:
        x = (max(f_i,f_i_1,f_N))
        break
    i+=1
if x != 0.1:
    print(x)
else:
    print(f_N)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

if N>=B-1 and A%B!=0:
  print(A-1-int(A/B))
elif N>=B-1:
  print(A-A/B)
else:
  print(int(A*N/B)-A*int(N/B))