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
from math import floor
A,B,N = map(int,input().split())
maxi = 0
Npower = 0
diff = 0
S = N
while S/10 >= 1:
    Npower += 1
    S /=10
if Npower >= 8: 
    for i in range(0,10**6+10**5):
        maxi = max(floor((A*i)/B)-A*floor(i/B),maxi)
    for i in range(N-10**6-10**5-10**4-10**3-10**2,N+1):
        maxi = max(floor((A*i)/B)-A*floor(i/B),maxi)
else:
    for i in range(0,N+1):
        maxi = max(floor((A*i)/B)-A*floor(i/B),maxi)
print(max(maxi-1,0))

import math
from math import floor
A,B,N = map(int,input().split())
maxi = 0
Npower = 0
diff = 0
S = N
while S/10 >= 1:
    Npower += 1
    S /=10
if Npower >= 7:
    for i in range(0,10**6+3*10**5):
        maxi = max(int((A*i)/B)-A*int(i/B),maxi)
    for i in range(N-10**6,N+1):
        maxi = max(int((A*i)/B)-A*int(i/B),maxi)
else:
    for i in range(0,N+2):
        maxi = max(int((A*i)/B)-A*int(i/B),maxi)
print(max(maxi,0))

import math
A,B,N = mips()
K = N-1
print(max(math.floor(A*N/B)-A*math.floor(N/B),math.floor(A*K/B)-A*math.floor(K/B),0))

import math
A,B,N = map(int,input().split())
maxi = -100000
Npower = 0
diff = 0
while N > 1:
    N /=10
    Npower += 1
if Npower >= 6:
  diff = N-1000
for i in range(diff,N+1):
    maxi = max(math.floor(A*i/B)-A*math.floor(i/B),maxi,0)
print(maxi)


import math
from math import floor
A,B,N = map(int,input().split())
maxi = 0
Npower = 0
diff = 0
S = N
while S/10 >= 1:
    Npower += 1
    S /=10
if Npower >= 7:
    for i in range(0,10**6+10**5):
        maxi = max(int((A*i)/B)-A*int(i/B),maxi)
    for i in range(N-2*10**6,N+1):
        maxi = max(int((A*i)/B)-A*int(i/B),maxi)
else:
    for i in range(0,N+2):
        maxi = max(int((A*i)/B)-A*int(i/B),maxi)
print(max(maxi,0))


import math
from math import floor
A,B,N = map(int,input().split())
maxi = 0
Npower = 0
diff = 0
S = N
while S/10 >= 1:
    Npower += 1
    S /=10
if Npower >= 7:
    for i in range(0,10**6+10**5):
        maxi = max(int((A*i)/B)-A*int(i/B),maxi)
    for i in range(N-2*10**6,N+1):
        maxi = max(int((A*i)/B)-A*int(i/B),maxi)
else:
    for i in range(0,N+1):
        maxi = max(int((A*i)/B)-A*int(i/B),maxi)
print(0)

import math
A,B,N = map(int,input().split())
maxi = -100000
Npower = 0
diff = 0
while N > 1:
    N /=10
    Npower += 1
if Npower >= 6:
  diff = N-1000
for i in range(diff,N+1):
    maxi = max(math.floor(A*i/B)-A*math.floor(i/B),maxi,0)
print(maxi)

import math
A,B,N = map(int,input().split())
maxi = -100000
Npower = 0
while N > 1:
    N /=10
    Npower += 1
if Npower >= 6:
  diff = N-1000
else:
  diff = 0
for i in range(diff,N+1):
    maxi = max(math.floor(A*i/B)-A*math.floor(i/B),maxi,0)
print(maxi)

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

import math
from math import floor
A,B,N = map(int,input().split())
maxi = 0
Npower = 0
diff = 0
S = N
while S/10 >= 1:
    Npower += 1
    S /=10
if Npower >= 8: 
    for i in range(0,10**6+10**5):
        maxi = max(floor((A*i)/B)-A*floor(i/B),maxi)
    for i in range(N-10**6-10**5-10**4-10**3-10**2,N+1):
        maxi = max(floor((A*i)/B)-A*floor(i/B),maxi)
else:
    for i in range(0,N+1):
        maxi = max(floor((A*i)/B)-A*floor(i/B),maxi)
print(max(maxi+1,0))


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

Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Runtime Error

Wrong Answer

Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Accepted