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

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

print(max(f(x) for x in range(N + 1)))

Submission status: Time Limit Exceeded

Solution code:
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  a,b,n=LI()

  # right=n
  # ans=math.floor(a*right/b)-a*math.floor(right/b)
  # left=0
  # while left<=right:
  #   half=(left+right)//2
  #   _ans=math.floor(a*half/b)-a*math.floor(half/b)
  #   if _ans==ans:
  #     return ans
  #   elif _ans>ans:
  #     right=half-1
  #     ans=_ans
  #   else:
  #     left=half+1

  ans=int(a*1/b)-a*int(1/b)
  for i in range(int(math.sqrt(n)),n+1):
    ans=max(ans,int(a*i/b)-a*int(i/b))
  return ans

# main()
print(main())

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

print(max(ans))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
A, B, N = map(int,input().split())
 
L = []
 
if N >= 10000000000:
  for i in range(10000000000):
    r = (N-i+1)/B
    L.append(int(A*r)-A*int(r))
else:
  for i in range(N):
  	r = (i+1)/B
  	L.append(int(A*r)-A*int(r))
 
print(max(L))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
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,1000000):
        maxi = max(floor((A*i)/B)-A*floor(i/B),maxi,0)
    for i in range(N-10**7,N+1):
        maxi = max(floor((A*i)/B)-A*floor(i/B),maxi,0)
else:
    for i in range(0,N+1):
        maxi = max(floor((A*i)/B)-A*floor(i/B),maxi,0)
print(maxi)

Submission status: Time Limit Exceeded

Solution code:
def LI(): return list(map(int,input().split()))
A,B,N = LI()
ans = 0
for i in range(max(N-N%B-A,1),N+1):
    temp = (A*i//B)-A*(i//B)
    ans = max(ans,temp)
print(ans)

Submission status: Time Limit Exceeded

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

if B>N:
  print(A*N//B)
  exit()

list=0
for i in range(1,N+1):
  if i>B:
    list=A*i//B
  else:
    c=((A*i)//B)-(A*(i//B))
    if list<c:
      list=c
print(list)

Submission status: Time Limit Exceeded

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

t = 0
max_num = 0
for i in range(n+1):
    t = math.floor(a*i / b) - a*math.floor(i/b)
    if max_num <= t:
        max_num = t
print(max_num)

Submission status: Time Limit Exceeded

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

import math

box = [0]
for x in range(1, n+1):
  floor = math.floor(a*x/b) - a*math.floor(x/b)
  box.append(floor)

box.sort(reverse=True)
print(box[0])

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

for i in range(n+1):
    k = int(a*i/b)-a*int(i/b)
    lis.append(k)
    
print(max(lis))

Submission status: Time Limit Exceeded

Solution code:
import math

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

l = [0]

for x in range(n+1):
    ans = 0
    ans = math.floor(a*x/b) - a * math.floor(x/b)
    l.append(ans)
    if max(l) > ans:
        break
print(max(l))

Submission status: Time Limit Exceeded

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

max_data = 0

for x in range(1, N + 1):
  a = math.floor(A * x / B) - A * math.floor(x / B)
  if a >= max_data:
    max_data = a
  
print(max_data)

Submission status: Time Limit Exceeded

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


value=[]
for x in range(n+1):
    value.append((a*x//b)-a*(x//b))

print(max(value))

Submission status: Time Limit Exceeded

Solution code:
A, B, N = map(int,input().split())
mmax=0
N_min = A//B+1
N_max = N if B > N else B
for n in range(N_min, N_max + 1):
    _max = int(A*n/B)-(A*int(n/B))
    if mmax < _max:
        mmax=_max

print(mmax)

Submission status: Time Limit Exceeded

Solution code:
import math

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

patterns = [(x * A // B) % A for x in range(1, B + 1)]

if len(patterns) <= N:
    print(max(patterns))
else:
    print(patterns[N-1])

Submission status: Time Limit Exceeded

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

list =[]
for x in range(n+1) :
    k = int(a*x/b) - a* int(x/b)
    list.append(k)
print(max(list))

Submission status: Time Limit Exceeded

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

arr = []
for i in range(n):
    x = i + 1
    solve = ((a*x)//b) - a * (x//b)
    arr.append(solve)

print(max(arr))

Submission status: Time Limit Exceeded

Solution code:


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

max_ = -A
A*N
if B > N:
    max_ = int((A*N)/B) - A * int(N/B)
elif A*N < B:
    max_= 0
else:
    for x in range(N+1):
        num = int((A*x)/B) - A * int(x/B)
        if num > max_:
            max_ = num

print(max_)

Submission status: Time Limit Exceeded

Solution code:
A, B, N = map(int, input().split())
# S = input()
# X1_list = [int(input()) for i in range(N)]
# X2_list = [list(map(int,input().split())) for i in range(N)]


ans = 0
before_ans = 0
for i in range(1, N + 1):
    a = int(A * i / B)
    b = A * int(i / B)
    ans = max(ans, a - b)
    #print(i, ans)
    if before_ans > ans:
        break
    if ans == min(A - 1, B - 1):
        break
    before_ans = a - b
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math

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

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

    print(output)


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
inputs = input().split(' ')
a = int(inputs[0])
b = int(inputs[1])
n = int(inputs[2])

output = 0
ab = a*b
for x in range(1, n + 1):
    if x % ab == 0:
        break
    buf = (a*x//b) - a*(x//b)
    if buf > output:
        output = buf

print(output)

Submission status: Time Limit Exceeded

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

print(max)

Submission status: Time Limit Exceeded

Solution code:
import math

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

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

print(_max)

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	D_fix
# CreatedDate:  2020-05-02 22:15:22 +0900
# LastModified: 2020-05-02 22:17:35 +0900
#


import os
import sys


def main():
    a,b,n=map(int,input().split())
    tmp=0
    for x in range(n+1):
        k=(a*x-a*x%b)//b - a*(x-x%b)//b
        if tmp < k:
            tmp=k
    print(tmp)


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin
import sys
import math

A, B, N = list(map(int, stdin.readline().rstrip().split()))

ans = []

#for x in range(N+1):
#    ans.append(math.floor(A * x / B) - A * math.floor(x / B))


loop = min(B+1 ,N+1)
for x in range(loop):
    ans.append(math.floor(A * x / B) - A * math.floor(x / B))


print(max(ans))

Submission status: Time Limit Exceeded

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

max_v = 0
for i in range(1, N + 1):
    current_max_v = math.floor(A * i // B) - A * math.floor(i / B)
    max_v = max(max_v, current_max_v)
print(max_v)

Submission status: Time Limit Exceeded

Solution code:
a,b,n=map(int,input().split())
'''
lst=[]
for i in range(n+1):
    now=int(a*i/b)-a*int(i/b)
    lst.append(now)
print(max(lst))
'''
lst=[]
if n>=b:
    ans=int(a*(n-1)/b)-a*int((n-1)/b)
    ans2=int(a*n/b)-a*int(n/b)
    for i in range(n//b+1):
        ans3=int(a*(i*b-1)/b)-a*int((i*b-1)/b)
        lst.append(ans3)
    print(max(ans,ans2,max(lst)))

else:
    ans=int(a*(n)/b)-a*int((n)/b)
    print(max(ans,0))

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
import math

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

ans = 0

if ( B>N ):
  X = N
  ans = math.floor(A*X/B) - ( A * math.floor(X/B) )
  
else:
  M = math.floor( (N/B)+1 )
  for i in range(M):
    X = ( i * M ) - 1
    temp = math.floor(A*X/B) - ( A * math.floor(X/B) )
    if ( temp>ans ):
      ans = temp

print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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


floor_num=[]
   
for x in range(0,N+1):

    floor_num.append(int(A*x/B)-A*int(x/B))

if N >=B:
    floor_num.append(int(A*(B-1)/B))

print(max(floor_num))

Submission status: Time Limit Exceeded

Solution code:
a, b, n = map(int, input().split())
t = n // b
if t == 0:
    ans = int(a * n / b) - a * int(n / b)
else:
    ans = 0
    for i in range(t):
        x = b * i + (b - 1)
        if x > n:
            x = n
        else:
            pass
        
        tmp = int(a * x / b) - a * int(x / b)
        if tmp > ans:
            ans = tmp
        else:
            pass

print(ans)

Submission status: Time Limit Exceeded

Solution code:
def q4():
    A, B, N = [int(i) for i in input().split(" ")]
    m = 0
    for x in range(N + 1):
        m = max(m, (A * x) // B - A * (x // B))
    print(m)

q4()

Submission status: Time Limit Exceeded

Solution code:
a,b,n = map(int,input().split())
c = 0
e = b//a
d = []

for x in range(e,n+1):
    k = a*x
    l = x//b
    
    if c <= (k//b - a*l):
        c = k//b - a*l
    else:
        break

print(c)

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3
import sys


def solve(A: int, B: int, N: int):
    m = -1
    for i in range(N+1):
        x = i
        m = max([m, int((A*x)/B) - A * int(x/B)])
    return m


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    # N = pow(10, 9)
    print(solve(A, B, N))

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
import math
A,B,N = input().split()
A = int(A)
B = int(B)
N = int(N)
ans = 0
for x in range(N + 1):
    m = (A * x)
    n = x/B
    ans_2 = math.floor((m)/B) - (A * math.floor(n))

    if ans < ans_2:
        ans = ans_2

print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

if B > N:
    ans = int(A*N/B)
    print(ans)
else:
    ans = 0    
    x = B - 1
    while True:
        temp = int(A*x/B) - A*int(x/B)
        if ans > temp:
            break
        ans = temp
        x += B
        if x > N:
            break
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math

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

for i in range(1, N + 1):
    temp = math.floor(A*i/B) - (A * math.floor(i/B))
    if max < temp:
        max = temp

print(max)

Submission status: Time Limit Exceeded

Solution code:

a,b,n=map(int,input().split())
m=0
for i in range(1,n+1):
    s=i/b
    num=int(a*s)
    num-=a*int(s)
    if num>=m:
        m=num
    
print(m)

Submission status: Time Limit Exceeded

Solution code:
A, B, N = list(map(int, input().split()))
s = 0
temp = []

for x in range(1,N+1):
  s = (A*x)//B-A*(x//B)
  temp.append(s)

print (max(temp))

Submission status: Time Limit Exceeded

Solution code:
import math

a, b, n = tuple(map(int, input().split()))
i = 0
j=0
ans=0
for i in range(1,n+1):
    c=i/b
    j=math.floor(a*c)-a*math.floor(c)
    ans=max(ans,j)
    i=i+b-2

print(ans)

Submission status: Time Limit Exceeded

Solution code:
from math import floor 
a,b,n=map(int,input().split())
ans=0
for x in range(n+1):
    an=(floor(a*x/b))-a*floor(x/b)
    if an>ans:
        ans=an
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):
    tmp = (a*x // b) - a * (x//b)
    # print(ans)
    ans = max(ans, tmp)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
ABN = list(map(int,input().split()))
A = ABN[0]
B = ABN[1]
N = ABN[2]

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

Submission status: Time Limit Exceeded

Solution code:
import math


nums = [int(e) for e in input().split()]

a = nums[0]
b = nums[1]
n = nums[2]

max_score = -1
score = -1

for x in range(1, n+1):
    score = math.floor(a*x/b) - a* math.floor(x/b)
    if max_score < score:
        max_score = score
        x += 1
    elif x > b:
        break

print(max_score)

Submission status: Time Limit Exceeded

Solution code:
a,b,n = [int(i) for i in input().split()]

ans = [0 for _ in range(b)]

for i in range(b):
    ans[i] = (a*i // b - a * (i // b))
    
ans = ans[:n+1]

print(max(ans))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
data = input().split()
a = int(data[0])
b = int(data[1])
n = int(data[2])

max = 0
cnt = 1
for i in range(n+1):
    x = cnt * b - 1
    if x > n:
        x = n
        i = n
    test = int(a*x/b) - a*int(x/b)
    if max < test:
        max = test
    i = i + b
    cnt = cnt + 1
print(max)

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin
import sys

A, B, N = [int(x) for x in stdin.readline().rstrip().split()]
# N, M = [int(x) for x in stdin.readline().rstrip().split()]
# U = input().split()
ans = int((A*N)/B)-A*int(N/B)
p = N//10
for i in range(p, N+1):
    temp = int((A*i)/B)-A*int(i/B)
    if temp > ans:
        # print(i)
        ans = temp

print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math

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

for x in range(n + 1):
    f1_bef = a * x / b
    f2_bef = x / b
    f1 = math.floor(f1_bef)
    f2 = math.floor(f2_bef)
    ans = f1 - a * f2
    ans_list.append(ans)

print(max(ans_list))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

for x in range(N+1):
  f = int(A*x/B) - A*int(x/B)
  if(max <= f):
    max = f
  if(max != 0 and f == 0):
    break
print(max)

Submission status: Time Limit Exceeded

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

max = 0
for x in range(N+1):
    # val = A * ((x / B) % 1) - ((A*x/B) % 1)
    val = math.floor(A*x/B) - A*math.floor(x/B)
    if val > max:
        max = val
print(int(max))

Submission status: Time Limit Exceeded

Solution code:
import sys

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


max_ = 0
pred = 0
for i in range(n+1):
    ans_ = int(a*i/b) - a*int(i/b)
    if max_ <= ans_:
        max_ = ans_
    if ans_ < pred:
        print(pred)
        sys.exit()
    pred = ans_
print(max_)

Submission status: Time Limit Exceeded

Solution code:

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

# アレイ import numpy as np =np.array(list(map(float,input().split())))

# 文字列 =list(str(input()).split(" " or ","))

# 一文字＆連番(縦横可能) =map(int, open(0).read().split())

# 2-d list
lis=[[] for _ in range(M)]
for i in range(M):
    lis[i] = list(map(int,input().split()[0:]))

# Each list
N = int(input())
a = [0] * N
b = [0] * N
c = [0] * N
for i in range(N):
    a[i], b[i], c[i] = map(int, input().split())
"""

import math
a,b,n=map(int,input().split())
kai=[]
for i in range(b,n+1,b):
    k=math.floor(a*i/b)-a*math.floor(i/b)
    kai.append(k)
    k=math.floor(a*(i-1)/b)-a*math.floor((i-1)/b)
    kai.append(k)

if len(kai)==0:
    kai.append(math.floor(a*n/b)-a*math.floor(n/b))
print(max(kai))

Submission status: Time Limit Exceeded

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

c=[]
m=0

for x in range(n+1):

    c.append(int(a*x/b)-a*int((x/b)))

    if int(c[x])>=m:

        m=int(c[x])

print(m)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

ans = [0]
for x in range(1, N+1):
    ad = int((A*x)/B) - (A*int(x/B))
    ans.append(ad)
    
print(max(ans))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import math

A, B, N = (int(x) for x in input().split())
h = []
a = 0
for i in range(0, N+1):
    a = math.floor(A * i / B) - A * math.floor(i / B)
    h.append(a)
print(max(h))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
A,B,N=map(int,input().split())
M=0
if B<N:
	C=B
else:
	C=N
for i in range(C+1):
	x=int(A*i/B)
	y=int(i/B)
	z=x-A*y
	if M<z:
		M=z
print(M)

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin
import sys
import math

A, B, N = list(map(int, stdin.readline().rstrip().split()))

ans = []

#for x in range(N+1):
#    ans.append(math.floor(A * x / B) - A * math.floor(x / B))


for x in range(min(B+1 ,N+1)):
    ans.append(math.floor(A * x / B) - A * math.floor(x / B))


print(max(ans))

Submission status: Time Limit Exceeded

Solution code:
import math
i = list(map(int, input().split()))
a = i[0]
b = i[1]
n = i[2]
#print(a,b,n)
f = 0
tf = 0
x = 1
for x in range(n+1):
  tf = math.floor(a*x/b) - a * math.floor(x/b)
  if tf >= f:
    f = tf
print(f)

Submission status: Time Limit Exceeded

Solution code:


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

max_ = -A
A*N
if B > N:
    max_ = int((A*N)/B) - A * int(N/B)
else:
    for x in range(N+1):
        num = int((A*x)/B) - A * int(x/B)
        if num > max_:
            max_ = num

print(max_)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import math
A, B, N = list(map(int, input().split()))
def floor(t):
    if t == 0 or t == int(t):
        return t
    return math.floor(t)

ans = 0
if B+1 < N:
    C = B+1
else:
    C = N
for i in range(1, C+1):
    val = floor(A*i/B) - A*floor(i/B)
    #print("i", i, "val", val)
    ans = max(ans, val)

print(ans)

Submission status: Time Limit Exceeded

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

A = int(A)
B = int(B)
N = int(N)

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

print(max(result))

Submission status: Time Limit Exceeded

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

list =[]
for x in range(n+1) :
    k = int(a*x/b) - a* int(x/b)
    list.append(k)
    x += 1
print(max(list))

Submission status: Time Limit Exceeded

Solution code:
import math
a, b, n = map(int,input().split())
ans = 0
m = math.floor(n/10)
for i in range(m,n+1):
    s = math.floor(a * i / b)
    t = math.floor (i/b)
    ans = max(ans,s - a*t)     
print(ans)

Submission status: Time Limit Exceeded

Solution code:
a,b,n = map(int,input().split())
c = 0
e = b//a
d = []

for x in range(e,n+1):
    k = a*x
    l = x//b
    
    if c <= (k//b - a*l):
        c = k//b - a*l
        d.append(c)
    else:
        break

s = max(d)

print(s)

Submission status: Time Limit Exceeded

Solution code:
def main():
    A, B, N = (int(x) for x in input().split())
    mini = 0
    if N >= B:
        for x in range(B-1, N+1, B):
            k = x / B
            ans = int(A*k) - int(k)
            if ans > mini:
                mini = ans
    else:
        for x in range(1, N+1):
            k = x / B
            ans = int(A * k)
            if ans > mini:
                mini = ans
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

ans = set()

for i in range(N + 1):
  ans.add(int(i * A / B) - A * int(i / B))
  
print(max(ans))

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

x = [i+1 for i in range(N)]

gokei = []
for a in x:
  #floor(Ax/B)
  floor1 = int((A*a)/B)
  floor2 = int(a/B)
  test = floor1 - A * floor2
  gokei.append(test)

gokei.sort(reverse=True)
print(gokei[0])

Submission status: Time Limit Exceeded

Solution code:
from math import floor


a, b, n = [int(x) for x in input().split()]
x  = 1
maxs =  0
while x <= n:
    curr = floor(a * x / b) - a * floor(x / b)
    maxs = max(maxs, curr)
    x += 1
print(maxs)

Submission status: Time Limit Exceeded

Solution code:
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  a,b,n=LI()

  # right=n
  # ans=math.floor(a*right/b)-a*math.floor(right/b)
  # left=0
  # while left<=right:
  #   half=(left+right)//2
  #   _ans=math.floor(a*half/b)-a*math.floor(half/b)
  #   if _ans==ans:
  #     return ans
  #   elif _ans>ans:
  #     right=half-1
  #     ans=_ans
  #   else:
  #     left=half+1

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

# main()
print(main())

Submission status: Time Limit Exceeded

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

ans = 0

for x in range(n+1):
    f = x/b
    if f-int(f) > ans:
        ans = f-int(f)
        continue

print(int(ans*a))

Submission status: Time Limit Exceeded

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


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

index = 1
prev = -1
max_num = -1
flag = True
if B == 1:
    flag = False
    max_num = 0

while flag and index <= N:
    tmp = calc(index)
    if tmp < prev:
        flag = False
    else:
        prev = tmp
    if max_num < tmp:
        max_num = tmp

    index += 1

print(max_num)

Submission status: Time Limit Exceeded

Solution code:
arr = input().split(" ")
A = int(arr[0])
B = int(arr[1])
N = int(arr[2])
s=[]
for x in range(1,N+1):
    y=int((A*x)/B)-A*int(x/B)
    s.append(y)
print(max(s))

Submission status: Time Limit Exceeded

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

data = []

for x in range(1, N + 1):
  data.append(math.floor(A * x / B) - A * math.floor(x / B))
  
print(max(data))

Submission status: Time Limit Exceeded

Solution code:
A,B,N=map(int,input().split())
i=int(0)
j=int(0)
k=int(0)
while i<=N:
  if A*i>B:
    j=(A*i)//B-A*(i//B)
    if k<j:
      k=j
  i=i+1
print(k)

Submission status: Time Limit Exceeded

Solution code:
#########行列読み込み ##############################################
"""
from sys import stdin
n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
print(data)
print(*data, sep='\n')
"""
##################################################################
#########入力系####################################################
"""
s =input()
s=list(input())
a=int(input())
x,y = map(int,input().split())	
li = input().split()	
li = list(map(int,input().split()))	
li = input().split('T')	
"""
##################################################################

#########行列読み込み ##############################################
"""
from sys import stdin
n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
print(data)
print(*data, sep='\n')
"""
##################################################################
#########入力系####################################################
"""
s =input()
s=list(input())
a=int(input())
x,y = map(int,input().split())	
li = input().split()	
li = list(map(int,input().split()))	
li = input().split('T')	
"""
##################################################################
import math
A,B,N = map(int,input().split())
left = math.floor(A/B)
if N > B:
    li = [i for i in range(left,B+1) ]
else:
    li = [i for i in range(left,N+1) ]
m = 0

for i in li:
    m = max(m,(A*i)//B-(A*(i//B)))
print(m)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import math
 
data = str(input())
data = data.split(" ")
 
answer = 0
for i in range(int(data[2])+1):
  first = math.floor(int(data[0])*i/int(data[1]))
  second = int(data[0]) * math.floor(i/int(data[1]))
  result = first - second
  if result > answer:
    answer = result
print(answer)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
A, B, N= map(int, input().split())
max=0

for i in range(N):
    x=i+1
    f=np.math.floor(A*x/B)-A*np.math.floor(x/B)
    if max<f:
        max=f
print(max)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
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: 
    diff = N-10**7
    for i in range(0,10000000):
        maxi = max(floor((A*i)/B)-A*floor(i/B),maxi,0)
    for i in range(diff,N+1):
        maxi = max(floor((A*i)/B)-A*floor(i/B),maxi,0)
else:
    for i in range(0,N+1):
        maxi = max(floor((A*i)/B)-A*floor(i/B),maxi,0)
print(maxi)

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
# モジュールのインポート
import math

# 標準入力の取得
A, B, N = list(map(int, input().split()))


def func(x: int) -> int:
    """目的関数

    Arguments:
        x {int} -- N以下の非負整数

    Returns:
        int -- 目的関数値
    """
    x_B = x / B
    return math.floor(A*x_B) - A*math.floor(x_B)


# 求解処理
result = 0
for x in range(min(N, B-1), N+1, B):
    result = max(result, func(x))

# 結果出力
print(result)

Submission status: Time Limit Exceeded

Solution code:
import math

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

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

Submission status: Time Limit Exceeded

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

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

print(max([f(A, B, x) for x in range(1,min(N + 1, B + 1))]))