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: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
a,b,n=map(int,input().split())
ans=0
x=0
y=0
# while(x<=n or y<=n):
#     ans=max(ans,((a*x)//b - a*(x//b)),((a*y)//b - a*(y//b)))
#     x+=b
#     y=-(-x//a)

for i in range(n+1):
    ans=max(ans,((a*i)//b - a*(i//b)))
print(ans)

Submission status: Time Limit Exceeded

Solution code:
a,b,n=map(int,input().split())
ans=0
x=0
y=0
while(x<=n or y<=n):
    ans=max(ans,((a*x)//b - a*(x//b)),((a*y)//b - a*(y//b)))
    x+=b
    y=-(-x//a)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
a,b,n=map(int,input().split())
ans=0
x=0
while(x<=n or -(-x//a)<=n):
    ans=max(ans,((a*x)//b - a*(x//b)))
    y=-(-x//a)
    ans=max(ans,((a*y)//b - a*(y//b)))
    x+=b
print(ans)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

if n >= b-1:
  print(a*(b-1)//b - a*((b-1)//b))
else:
  ans = 0
  for x in range(1,n+1):
    ans = max(ans, int(a*x/b) - a*int(x/b))
  print(ans)

Submission status: Time Limit Exceeded

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

# x=0の場合、値は0
ans = 0
# x=1～Nについて
for x in range(1, min(B+1,N+1)):
    if (A*x)//B - A*(x//B) > ans:
        ans = (A*x)//B - A*(x//B)
        
print(ans)

Submission status: Time Limit Exceeded

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

# x=0の場合、値は0
ans = 0
# x=1～Nについて
for x in range(1, N+1):
    if (A*x)//B - A*(x//B) > ans:
        ans = (A*x)//B - A*(x//B)
        
print(ans)

Submission status: Time Limit Exceeded

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

max = num = int(a*n/b) - a * int(n/b)

for x in range(0, n+1, b):
    num = int(a*(x-1)/b) - a * int((x-1)/b)
    if num > max:
        max = num

print(max)

Submission status: Time Limit Exceeded

Solution code:

import glob
import bisect
import sys

# 問題ごとのディレクトリのトップからの相対パス
REL_PATH = 'ABC\\165\\D'

# テスト用ファイル置き場のトップ
TOP_PATH = 'C:\\AtCoder'

class Common:

    problem = []
    index = 0

    def __init__(self, rel_path):
        self.rel_path = rel_path

    def initialize(self, path):
        file = open(path)
        self.problem = file.readlines()
        self.index = 0
        return

    def input_data(self):
        try:
            IS_TEST
            self.index += 1
            return self.problem[self.index-1]

        except NameError:
            return input()

    def resolve(self):
        pass

    def exec_resolve(self):
        try:
            IS_TEST
            for path in glob.glob(TOP_PATH + '\\' + self.rel_path + '/*.txt'):
                print("Test: " + path)
                self.initialize(path)
                self.resolve()
                print("\n\n")
        except NameError:
            self.resolve()


class Solver(Common):

    def resolve(self):

        A, B, N = map(int, self.input_data().split())

        f_max = sys.maxsize * -1

        max_index = N+1
        if B < max_index:
            max_index = B+1

        for x in range(1, max_index):

            left = int(A * x / B)
            right = int(x / B) * A
            if left - right > f_max:
                f_max = left - right

        print(int(f_max))


solver = Solver(REL_PATH)
solver.exec_resolve()

Submission status: Time Limit Exceeded

Solution code:

import glob
import bisect
import sys

# 問題ごとのディレクトリのトップからの相対パス
REL_PATH = 'ABC\\165\\D'

# テスト用ファイル置き場のトップ
TOP_PATH = 'C:\\AtCoder'

class Common:

    problem = []
    index = 0

    def __init__(self, rel_path):
        self.rel_path = rel_path

    def initialize(self, path):
        file = open(path)
        self.problem = file.readlines()
        self.index = 0
        return

    def input_data(self):
        try:
            IS_TEST
            self.index += 1
            return self.problem[self.index-1]

        except NameError:
            return input()

    def resolve(self):
        pass

    def exec_resolve(self):
        try:
            IS_TEST
            for path in glob.glob(TOP_PATH + '\\' + self.rel_path + '/*.txt'):
                print("Test: " + path)
                self.initialize(path)
                self.resolve()
                print("\n\n")
        except NameError:
            self.resolve()


class Solver(Common):

    def resolve(self):

        A, B, N = map(int, self.input_data().split())

        f_max = sys.maxsize * -1

        for x in range(1, N+1):

            left = int(A * x / B)
            right = int(x / B) * A
            if left - right > f_max:
                f_max = left - right

        print(int(f_max))


solver = Solver(REL_PATH)
solver.exec_resolve()

Submission status: Time Limit Exceeded

Solution code:
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():
    
    ans = 0
    i = 0
    while B > i and i <= N:
        fi = f(i)
        ans = f(i) if ans < fi else ans
        i += 1 
    
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
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():
    
    ans = 0
    for i in range(N+1):
        fi = f(i)
        ans = f(i) if ans < fi else ans

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
import math

A,B,N = input().split(" ")
Ans = 0

for x in range(1,int(N)+1):
  tmp = int(math.floor(int(A)*x/int(B)) - int(A) * math.floor(x/int(B)))
  if tmp >= Ans:
    Ans = tmp

print(Ans)

Submission status: Time Limit Exceeded

Solution code:
import math

A,B,N = input().split(" ")
Ans = 0

for x in range(1,int(N)+1):
  a = math.floor(int(A)*x/int(B))
  b = math.floor(x/int(B))
  c = int(a - int(A) * b)
  if c >= Ans:
    Ans = c

print(Ans)

Submission status: Time Limit Exceeded

Solution code:
import math
import sys
readline = sys.stdin.readline


def main():
    a, b, n = map(int, readline().rstrip().split())
    maxt = 0
    for x in range(n):
        maxt = max(maxt, math.floor(a * (x + 1) / b) -
                   a * math.floor((x+1) / b))
    print(maxt)


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
from math import floor
A, B, N = map(int, input().split())
R = -100000
for i in range(min(N,B)+1):
  R = max(R, floor(A*i/B)-A*floor(i/B))
print(R)

Submission status: Time Limit Exceeded

Solution code:
from math import floor
A, B, N = map(int, input().split())
R = -100000
for i in range(N+1):
  R = max(R, floor(A*i/B)-A*floor(i/B))
print(R)

Submission status: Time Limit Exceeded

Solution code:
import math
A, B, N = map(int,input().split())
ans = 0
for i in range(1,min(N+1%B,B)):
  X = math.floor(A*i//B)-A*math.floor(i//B)
  if(X>=ans):
    ans = X
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math
A, B, N = map(int,input().split())
ans = 0
for i in range(1,min(N+1,B)):
  X = math.floor(A*i//B)-A*math.floor(i//B)
  if(X>=ans):
    ans = X
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math
A, B, N = map(int,input().split())
ans = 0
for i in range(1,N+1):
  X = math.floor(A*i//B)-A*math.floor(i//B)
  if(X>=ans):
    ans = X
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math
A,B,N = map(int,input().split())
res = 0

for x in range(1, B+1):
  res = max(res, math.floor(A*x/B)-A*math.floor(x/B))
  if x == N:
    print(res)
    exit()

print(res)

Submission status: Time Limit Exceeded

Solution code:
A, B, N = map(int, input().split())
result = []
cnt = 0

for _ in range(N):
  cnt += 1
  result.append(int(A*cnt/B)-A*int(cnt/B))
  
print(max(result))

Submission status: Time Limit Exceeded

Solution code:
import math

A, B, N = map(int, input().split())
result = []
cnt = 0

for _ in range(N):
  cnt += 1
  result.append(math.floor(A*cnt/B)-A*math.floor(cnt/B))
  
print(max(result))

Submission status: Time Limit Exceeded

Solution code:
import math
a,b,c=map(int,input().split())
d=[]
for i in range(c+1):
    n=math.floor((a*i)/b)-a*(math.floor(i/b))
    d.append(n)
d=sorted(d)
print(d[-1])

Submission status: Time Limit Exceeded

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

maxP=-10**15

if N<100000000:
    for i in range(1,N+1):
        tmp=(A*i)//B-A*(i//B)
        if maxP<tmp:
            maxP=tmp
        
else:
    for i in range(1,10000000):
        tmp=(A*i)//B-A*(i//B)
        if maxP<tmp:
            maxP=tmp
    for i in range(N-10000000,N+1):
        tmp=(A*i)//B-A*(i//B)
        if maxP<tmp:
            maxP=tmp
print(maxP)

Submission status: Time Limit Exceeded

Solution code:
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(100000)


def main():
    A, B, N = [int(i) for i in input().strip().split()]
    ans = 0
    if N >= B:
        for n in range(B-1, N+1, B):
            ans = max(ans, ((A * n) // B) - (A * (n // B)))
    else:
        ans = ((A * N) // B) - (A * (N // B))
    return ans


if __name__ == "__main__":
    print(main())

Submission status: Time Limit Exceeded

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

if n < b:
    ans = a * n // b  
    print(ans)
    sys.exit()  
elif n == b:
    ans = a * (b-1) // b
    print(ans)
    sys.exit()

# n == 1のときは0 問題なし
r = n // b
ans = 0
for i in range(1, r + 1):
    t = i * b - 1
    ans_t = a * t // b - (a * (i - 1))
    ans = max(ans, ans_t) 
    # print(i, t, ans)

t = r * b - 1
ans_t = a * t // b - (a * (r - 1))
ans = max(ans, ans_t) 

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

print(ans)

Submission status: Time Limit Exceeded

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

r = n // b
ans = 0

for i in range(1, r + 1):
    t = i * b - 1
    ans_t = a * t // b - (a * (i - 1))
    ans = max(ans, ans_t) 
    # print(i, t, ans)

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

print(ans)

Submission status: Time Limit Exceeded

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

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math

A, B, N = [int(x) for x in input().split()]
val = 0

for i in range(min(B, N+1)):
    a = math.floor(float(A*i)/B) - A * math.floor(float(i)/B)
    if a > val:
        val = a

print(val)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

for x in range(n+1):
  ans.append(a*x//b - a*(x//b))
print(max(ans))

Submission status: Time Limit Exceeded

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

ans = 0

for x in range(0, N+1):
  
  a = ( int((A*x)/B) - A*int(x/B) )
  if ans < a:
    ans = a
    
print(ans)

Submission status: Time Limit Exceeded

Solution code:
from math import floor
A,B,N = map(int, input().split())
before = 0
for x in range(N+1):
    now = A*x//B - A*(x//B)
    if now < before:
        break
    before = now
print(before)

Submission status: Time Limit Exceeded

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

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

if n < b - 1:
    max = f(n)
else:
    x = b - 1
    max = f(x)
    while x <= n:
        if max < f(x):
            max = f(x)
        x += b

print(max)

Submission status: Time Limit Exceeded

Solution code:
from math import floor

A,B,N = map(int,input().split())
Max = -100000000000000
for i in range(1,N+1):
    Max = max(Max,floor(A*i/B)-A*floor(i/B))

print(Max)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
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())
numls = [i for i in range(N+1)]
ansls = []
for x in range(len(numls)):
  ansls.append(f(A, B, x))
print(max(ansls))

Submission status: Time Limit Exceeded

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 = int(A*(B-1)/B)
else:
    Max = int(A*N/B)
print(Max)

Submission status: Time Limit Exceeded

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

Max = 0

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

Submission status: Time Limit Exceeded

Solution code:
A,B,N = [int(x) for x in input().split()]

def f(x):
    return int(A*x/B) - A * int(x/B)

R = f(N)
for xb in range(N//B):
    x = (xb+1) * B - 1
    R = max(R,f(x))
print(R)

Submission status: Time Limit Exceeded

Solution code:
a, b, n = map(int, input().split())
ans = 0
for i in range(n, 0, -1):
    value = (a*i//b) - a*(i//b)
    ans = max(value, ans)
print(ans)

Submission status: Time Limit Exceeded

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(1, N//B+1):
    ans.append(f(B*i-1))
ans.append(f(N))
ans.append(f(1))
#print(f(N))
print(max(ans))

Submission status: Time Limit Exceeded

Solution code:
from math import floor

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

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

for x in range(N+1):
    t = calc(x)
    if t < result:
        break
    result = max(result, t)
    
print(result)

Submission status: Time Limit Exceeded

Solution code:
from math import floor

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

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

for x in range(N+1):
    result = max(result, calc(x))
    
print(result)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import math

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

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:

from math import floor

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

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

  limit_N = 10000000
  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: Time Limit Exceeded

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:
    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: Time Limit Exceeded

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)

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: Time Limit Exceeded

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

print(maxpoint)

Submission status: Time Limit Exceeded

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 :
            maxpoint = max(tmp,maxpoint)
            print(maxpoint) 
            exit()
    elif b == 1:
        print(0)
        exit()
    maxpoint = max(tmp,maxpoint)
    # print(maxpoint)

print(maxpoint)

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin
input = stdin.readline
a,b,n = map(int,input().split())
maxpoint = 0
for x in range(n+1):
    tmp = int((a * x) / b)  - a * int(x/b) 
    maxpoint = max(tmp,maxpoint)
print(maxpoint)

Submission status: Time Limit Exceeded

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

maxpoint = 0
for x in range(n+1):
    t1 = (a * x) / b
    t2 = x/b
    tmp = int(t1)  - a * int(t2) 
    maxpoint = max(tmp,maxpoint)

print(maxpoint)

Submission status: Time Limit Exceeded

Solution code:
import math


li = list(map(int,input().split()))

def main():

	max = 0
	for i in range(li[2]+1):
		l = (math.floor((li[0]*i)/li[1]) - li[0]*(math.floor(i/li[1])))
		if l > max:
			max = l
	return(print(max))

      

main()

Submission status: Time Limit Exceeded

Solution code:

import math


li = list(map(int,input().split()))

def main():

	x = []
	for i in range(li[2]+1):
		x.append(math.floor((li[0]*i)/li[1]) - li[0]*(math.floor(i/li[1])))
	max = 0
	for l in x:
		if l>max:
			max = l
	return(print(max))

      

main()

Submission status: Time Limit Exceeded

Solution code:
A, B, N = map(int, input().split())
c = 0
i = 1
x = B * i - 1
while x <= N:
    cc = (A * x) // B - A * (x // B)
    c = max(c, cc)
    i += 1
    x = B * i - 1
if c == 0:
    x = N
    c = (A * x) // B - A * (x // B)
print(c)

Submission status: Time Limit Exceeded

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

def floor(t):
  return int(t)

max = 0 
for x in range(N+1):
  y = floor(A*x/B)-A*floor(x/B)
  if y > max:
    max = y
    
print(max)

Submission status: Time Limit Exceeded

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

def floor(t):
  return int(t)

max = 0 
for x in range(1, N+1):
  y = floor(A*x/B)-A*floor(x/B)
  if y > max:
    max = y
    
print(max)

Submission status: Time Limit Exceeded

Solution code:
a, b, n = map(int, input().split())
c = [0 for i in range(n+1)]
x = 0
while x <= b and x <= n:
  c[x] = (a*x)//b - a*(x//b)
  x += 1
print(max(c))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import math
A,B,N=map(int,input().split())
C = 0
x = 1
while (x <= N):
    if N < B:
        C = math.floor(A*N/B) - A * math.floor(N/B)
        break
    else:
        if x % B == B - 1:
            C = math.floor(A*x/B) - A * math.floor(x/B)
            x += B
        else:
            x += B - 1 - x % B
print(C)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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-10000000,N+1):
        tmp = (A * x // B) - A * (x//B)
        ans.append(tmp)
        #print(tmp)
print(max(ans))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

for i in range(n+1):
  ans=math.floor(a*i/b)-a*math.floor(i/b)
  if ans==math.floor(a*(b-1)/b):
    print(ans)
    break
else:
  print(ans)

Submission status: Time Limit Exceeded

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

ma = 0

if(n < b):
    s = a * n / b
    t = n / b
    ss = s // 1
    tt = (t // 1) * a
    ma = ss - tt
else:
    for i in range(b-1,n+1,b):
        s = a * i / b
        t = i / b
        ss = s // 1
        tt = (t // 1) * a
        if(ma < ss - tt):
            ma = ss - tt

print(str(int(ma)))

Submission status: Time Limit Exceeded

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

bo = min(b,n)

ma = 0

for i in range(1,bo+1):
    s = a * i / b
    t = i / b
    ss = s // 1
    tt = (t // 1) * a
    if(ma < ss - tt):
        ma = ss - tt

print(str(int(ma)))

Submission status: Time Limit Exceeded

Solution code:
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(max_num)

Submission status: Time Limit Exceeded

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

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

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

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

else:
    for i in range(1,int(n//b+1)):
        x = b*i-1
        ans = max(ans, a*((x-(i-1)*b)/b))

print(int(ans//1))

Submission status: Time Limit Exceeded

Solution code:
from math import floor as floor
A, B, N = map(int, input().split())
maxvalue = 0
maxx = 0
for x in range(N+1):
    v = floor(A * x / B) - A * floor(x / B)
    if v > maxvalue:
        maxvalue = v
        maxx = x
print(maxvalue)

Submission status: Time Limit Exceeded

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

x = N
if B < N :
    x = int(N / B) * B - 1
elif B == N :
    x -= 1

if B < N:
    for i in range(int(N/B)+1):
        y = i * B - 1
        val = int(A * y / B) - A * int(y / B)
        # print(i)
        # print(val)


val = int(A * x / B) - A * int(x / B)
# print(x)
print(val)

Submission status: Time Limit Exceeded

Solution code:
import math

a,b,n = map(int, input().split())
l = []
for i in range(n + 1):
  c = math.floor(a * i / b) - a * math.floor(i / b)
  l.append(c)
print(max(l))

Submission status: Time Limit Exceeded

Solution code:
from math import floor

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

max_x = 0
x     = 0
a_b   = a / b

while n > 0:
    x = floor(a_b * (n % b))

    max_x = x if x > max_x else max_x

    n -= 1

print(max_x)

Submission status: Time Limit Exceeded

Solution code:
from math import floor

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

max_x = 0

while n > 0:
    x = floor(a * (n % b) / b)

    max_x = x if x > max_x else max_x

    n -= 1

print(max_x)

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    a, b, n = map(int, input().split())

    ans = 0

    for x in range(min(b, n + 1)):
        ans = max(int(a * x / b) - a * int(x / b), ans)

    print(ans)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

Submission status: Time Limit Exceeded

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

def floor(t):
    return int(t)

list = []
for x in range(N+1):
    list.append(floor((A*x)/B) - A*floor(x/B))

print(max(list))

Submission status: Time Limit Exceeded

Solution code:
import math
A,B,N = map(int, input().split())
c = 0
d = 0
for i in range(1,N+1):
	if B > N:
		d = (math.floor(A * N / B))-(A * (math.floor(N / B)))
		break
	c = (math.floor(A * i / B))-(A * (math.floor(i / B)))
	if c>d:
		d=c
print(d)

Submission status: Time Limit Exceeded

Solution code:
def floor(a):
    return int(a)

if __name__ == '__main__':
    abn = input()
    abn = abn.split()
    a = int(abn[0])
    b = int(abn[1])
    n = int(abn[2])

    max_amount = 0
    for i in range(1,n+1):
        amount = floor(a*i/b) -a*floor(i/b)
        max_amount = max(max_amount,amount)

    print(max_amount)

Submission status: Time Limit Exceeded

Solution code:
import math

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

max_num = 0
for x in range(1, N+1):
    t = math.floor(A * x / B) - A * math.floor(x / B)
    if t > max_num:
        max_num = t

print(max_num)

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/python
# -*- coding: utf-8 -*-

from math import floor,ceil

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

ans = 0

for n in range(0,ceil(N/(B/A))):
    ans = max(ans,floor(A*ceil((B/A)*n)/B)-A*floor(ceil((B/A)*n)/B))

print(ans)

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/python
# -*- coding: utf-8 -*-

from math import floor,ceil

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

check_list = {ceil((B/A)*n) for n in range(0,ceil(N/(B/A)))}

ans = 0

for n in check_list:
    ans = max(ans,floor(A*n/B)-A*floor(n/B))

print(ans)

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/python
# -*- coding: utf-8 -*-

from math import floor,ceil

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

#check_list1 = {B*n for n in range(0,ceil(N/B))}
check_list2 = {ceil((B/A)*n) for n in range(0,ceil(N/(B/A)))}
check_list3 = {floor((B/A)*n) for n in range(0,ceil(N/(B/A)))}

#check_list = check_list1.union(check_list2,check_list3)
check_list = check_list2 | check_list3

ans = 0

for n in check_list:
    ans = max(ans,floor(A*n/B)-A*floor(n/B))

print(ans)

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/python
# -*- coding: utf-8 -*-

from math import floor,ceil

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

check_list1 = {B*n for n in range(0,ceil(N/B))}
check_list2 = {ceil((B/A)*n) for n in range(0,ceil(N/(B/A)))}
check_list3 = {floor((B/A)*n) for n in range(0,ceil(N/(B/A)))}

check_list = check_list1.union(check_list2,check_list3)

ans = 0

for n in check_list:
    ans = max(ans,floor(A*n/B)-A*floor(n/B))

print(ans)

Submission status: Time Limit Exceeded

Solution code:
A, B, N = map(int, input().split())
ans = 0
for x in range(int(N**0.5), N+1):
    ans  = max(ans, (A*x)//B-A*(x//B))
print(ans)

Submission status: Time Limit Exceeded

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

Ans=[0]
for i in range(N+1):
    ans=math.floor(A*i/B)-A*(math.floor(i/B))
    Ans.append(ans)
    if Ans[i-1]>Ans[i]:
        break
    else:
        pass
    
#print(Ans)
print(max(Ans))

Submission status: Time Limit Exceeded

Solution code:
import math

a, b, n = map(int, input().split())
ans = math.floor(a*n/b) - a*math.floor(n/b)
x = b-1
while x <= n:
    ans = max(ans, math.floor(a*x/b) - a*math.floor(x/b))
    x += b
print(ans)

Submission status: Time Limit Exceeded

Solution code:
A, B, N = list(map(int,input().split()))
Max=(-1)*A
for x in range(N+1):
  S= A*x//B
  T=x//B
  ans= S-A*T
  Max=max(Max,ans)

print(Max)

Submission status: Time Limit Exceeded

Solution code:
A, B, N = list(map(int,input().split()))
t= list()
for x in range(N+1):
  S= A*x//B
  T=x//B
  ans= S-A*T
  t.append(ans)

print(max(t))

Submission status: Time Limit Exceeded

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