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

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

print(max)

Submission status: Time Limit Exceeded

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

mx = -1
for x in range(1, N+1):
  temp = ((A*x) // B) - A*(x//B)
  mx = max(mx, temp)

print(mx)

Submission status: Time Limit Exceeded

Solution code:
import math as m

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

list = []

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

print(max(list))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import math


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



#math.floor(

Submission status: Time Limit Exceeded

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

for i in range(N+1):
    if((A*i)//B - A*(i//B) > bst):
        bst = (A*i)//B - A*(i//B)

print(bst)

Submission status: Time Limit Exceeded

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

def calc(x):
    y = math.floor(A * x / B) - A * math.floor(x / B)
    return y

max_v = 0
for x in range(N+1):
    max_v = max(max_v, calc(x))

print(max_v)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
a,b,n = [int(_) for _ in 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())
maxFloor = 0


def floor(x):
    num = int(x // 1)
    return num


for x in range(N + 1):
    check = floor(A * x / B) - A * floor(x / B)
    maxFloor = max(maxFloor, check)
print(maxFloor)

Submission status: Time Limit Exceeded

Solution code:
import math

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

m = 0

for x in range(1,n+1):
    y = math.floor(a*x/b) - a * math.floor(x/b)
    if m < y:
        m = y

print(m)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

p=0
for i in range(n):
    c=(a*(i+1))//b
    d=((i+1)//b)*a
    q=c-d
    if q>p:
        p=q

print(p)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

max_ = (A*0)//B - A * (0//B)

for num in range(1, N//B + 2):
  #print(num)
  num1 = num * B -1
  if num1 > N:
    num1 = N
  #print(num1)
  ans = (A*(num1))//B - A * ((num1)//B)
  #print(ans)
  #print()
  if ans > max_:
    max_ = ans
print(max_)

Submission status: Time Limit Exceeded

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

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

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
a, b, n = map(int, input().split())
m = max(1, n - b)
c = 0
for i in range(n, m, - 1):
    d = (a * i) // b - a * (i // b)
    if d >= c:
        c = d
print(c)

Submission status: Time Limit Exceeded

Solution code:
A, B, N = list(map(int,input().split()))
def max_val(a, b, n):
  maxv = 0
  for x in range(0, n+1):
    maxv = max(maxv, int(a*x/b) - a*int(x/b))

  return maxv
    
print(max_val(A,B,N))

Submission status: Time Limit Exceeded

Solution code:
import math

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

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

print(min)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
import math
a, b, n = map(int, input().split())
sum = -200000
for x in range(1, n + 1):
  if math.floor(a * x / b) - a * math.floor(x / b) > sum:
    sum = math.floor(a * x / b) - a * math.floor(x / b)

print(sum)

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin
import math
import fractions

a, b, n = [int(x) for x in stdin.readline().rstrip().split()]

r = -100
for i in range(b):
    if (i > n):
        break
    if (r < (a * i / b)):
        r = a * i / b

print(int(r))

Submission status: Time Limit Exceeded

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

#print(A)
#print(B)
#print(N)

ret = 0
for i in range(1, N+1):
  #print(i)
  temp = math.floor(A * i / B) - A * math.floor(i / B)
  #print(temp)
  if temp > ret:
    ret = temp

  
print(ret)

Submission status: Time Limit Exceeded

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

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

prev = -1
for n in range(N + 1):
    res = func(n)
    if res < prev:
        print(prev)
        break
    prev = res
else:
    print(prev)

Submission status: Time Limit Exceeded

Solution code:
a,b,n = map(int,input().split())
ans = 0
for i in range(1,min(10**7+1,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())
x=0
for i in range(n+1):
  if x<=((a*i)//b)-a*(i//b):
    x=((a*i)//b)-a*(i//b)
print(x)

Submission status: Time Limit Exceeded

Solution code:
import math

a, b, n = map(int, input().split())
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:
A,B,N=map(int,input().split())
result=0
for x in range(0,N+1):
	a=(A*x)//B-A*(x//B)
	if a>result:
		result=a
print(result)

Submission status: Time Limit Exceeded

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

from sys import stdin
import numpy as np


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

    ans = -float('inf')

    for x in range(0, n + 1):
        _ = np.floor(a * x / b) - a * np.floor(x / b)
        if _ > ans:
            ans = _

    print(int(ans))


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

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

max = 0

for i in range(n+1):
  x = int((a*i)/b)-a*int(i/b)
  if x > max:
    max = x
  elif max > x:
    break
    
print(max)

Submission status: Time Limit Exceeded

Solution code:
A,B,N = map(int,input().split())
#N=int(input())
#A = list(map(int,input().split()))
#S=str(input())
m=-1
if B<N:
    N=B
for x in range(N+1):
    num=int(A*x/B) - A * int(x/B)
    m=max(num,m)

print(m)

Submission status: Time Limit Exceeded

Solution code:
import math

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

x = 0
answers = []

while x <= N:
    answers.append(math.floor(A * x / B) - A * math.floor(x / B))
    x += 1

print(max(answers))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
import math
a,b,n = map(int,input().split())
max = 0
x = 0
while math.floor(a*x/b) - a*math.floor(x/b) <= a and x <= n:
	if max < math.floor(a*x/b) - a*math.floor(x/b):
		max = math.floor(a*x/b) - a*math.floor(x/b)
	x += 1
print(max)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import math 

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

Submission status: Time Limit Exceeded

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

ans = 0
zero_cnt = 0
for i in range(n+1):
    tmp = int(a*i/b) - a*int(i/b)
    if ans != 0 and tmp == 0:
        break
    ans = max(ans, tmp)
print(ans)

Submission status: Time Limit Exceeded

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

for i in range(1, N+1):
    ans.append((A * i // B) - A * (i // B))

print(max(ans))

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
def resolve():
    # 整数 1 つ
    # n = int(input())
    # 整数複数個
    a, b, n = list(map(int, input().split()))
    # 整数 N 個 (改行区切り)
    # N = [int(input()) for i in range(N)]
    # 整数 N 個 (スペース区切り)
    # N = list(map(int, input().split()))
    # 整数 (縦 H 横 W の行列)
    # A = [list(map(int, input().split())) for i in range(H)]

    re=0
    maxre=0
    for x in range(n+1):
        re = int(a * x /b) - a * int(x /b)
        if maxre <= re:
            maxre = re

    print(maxre)


resolve()

Submission status: Time Limit Exceeded

Solution code:
a,b,n=map(int,input().split())
#lst=[]
x=0
for i in range(n+1):
  """
  lst.append(int(a*i/b)-a*int(i/b))
  """
  y=int(a*i/b)-a*int(i/b)
  if y>=x:
    x=y
    
print(x)

Submission status: Time Limit Exceeded

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

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

print(ans)

Submission status: Time Limit Exceeded

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


def solve(A: int, B: int, N: int):
    b=0
    for i in range(N+1):
        a=int((A*i)/B)-A*int(i/B)
        if a>b:
            b=a
    print(b)
    return


# 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
    solve(A, B, N)

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

ans = 0
for x in range(N+1):
    c = int(A*x/B)-A*int(x/B)
    #print(c)
    ans = max(ans,c)

print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math
A, B, N = list(map(int, input().split(" ")))
res = []

for i in range(N+1):
  r = math.floor(A*i/B) - A*math.floor(i/B)
  res.append(r)
print(max(res))

Submission status: Time Limit Exceeded

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

o = x
x = max(0, x - 2000000)

m = 0

while x <= o:
    r = max(0, o - x)

    m = max(m, (a*x) // b - a * (x // b))
    m = max(m, (a*r) // b - a * (r // b))
    x += 1

print(m)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import math
abn = list(map(int,input().split()))

temp = 0

for x in range(abn[2] + 1):
    m = math.floor(abn[0] * x / abn[1]) - abn[0] * math.floor(x / abn[1])

    if m > temp:
        temp = m

print(temp)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
a, b, c = map(int, input().split())
greater = 0
for i in range(c + 1):
    if int(a * i / b) - a * int(i / b) > greater:
        greater = int(a * i / b) - a * int(i / b)
print(greater)

Submission status: Time Limit Exceeded

Solution code:
ABN = [int(x) for x in input().split()]
y=0
for x in range(1,ABN[2]+1):
  if y<int(ABN[0]*x/ABN[1])-ABN[0]*int(x/ABN[1]):
    y=int(ABN[0]*x/ABN[1])-ABN[0]*int(x/ABN[1])
print(y)

Submission status: Time Limit Exceeded

Solution code:
import math


A, B, N = map(lambda x: int(x), input().split(" "))

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

print(result)

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/python3
# -*- coding: utf-8 -*-
a, b, n = map(int, input().split())
max_score = 0
for x in range(1, n + 1):
    score = int(a * x / b) - a * (x // b)
    if max_score < score:
        max_score = score
print(max_score)

Submission status: Time Limit Exceeded

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

o = x
x = max(0, x - 10000000)

m = 0

while x <= o:
    r = max(0, o - x)

    m = max(m, (a*x) // b - a * (x // b))
    m = max(m, (a*r) // b - a * (r // b))
    x += 1

print(m)

Submission status: Time Limit Exceeded

Solution code:
a, b, n = map(int, input().split())
ans = -float('inf')
for i in range(n, 0, -1):
    f1 = (a*i)//b
    f2 = i//b
    tmp = f1-(a*f2)
    if ans < tmp:
        ans = tmp
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from math import floor

a, b, n = map(int, readline().split())
max = 0
for i in range(n + 1):
    v = floor(a * i / b) - a * floor(i / b)
    if v >= max:
        max = v
    else:
        break
print(max)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

print(max(result))

Submission status: Time Limit Exceeded

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

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

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, int(a / b * x) - a * int(x / b))

print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
#abc165_d.py
import math
I = input().split()
A = int(I[0])
B = int(I[1])
N = int(I[2])

Max = 0
y = 0
for i in range(1,N+1):
    if i/B < 1:
        y = math.floor(A * i / B)
    else:
        y = math.floor(A * i / B) - A * math.floor(i / B)
    if (Max < y):
        Max = y

print(Max)

Submission status: Time Limit Exceeded

Solution code:
import math

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

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

Submission status: Time Limit Exceeded

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

for x in range( n+1 ):
    f_x = int( a * x / b ) - a * int( x / b )
    if x == 0 or f_max < f_x:
        f_max = f_x

print( f_max )

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import bisect
import collections
import sys

sys.setrecursionlimit(100000)
input = sys.stdin.readline
ACMOD = 1000000007
INF = 1 << 62


def lmi():
    return list(map(int, input().split()))


def llmi(n):
    return [lmi() for _ in range(n)]


A, B, N = lmi()
# (A*(x%B) - (A*x)%B )/B

if N < B:
    ans = -INF
    for i in range(1, N + 1):
        ans = max(ans, (A * (i % B) - (A * i) % B) // B)
    print(ans)
    exit()

i = B - 1
print((A * (i % B) - (A * i) % B) // B)

Submission status: Time Limit Exceeded

Solution code:
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

A, B, N = MAP()

left, right = 0, N

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

# while right-left > 1:
#     mid1 = (left + right)*1// 3
#     mid2 = (left + right)*2// 3

#     if f(mid1) < f(mid2):
#         left = mid1
#     else:
#         right = mid2
ans = 0
for i in range(1, N+1):
    ans = max(ans, f(i))
print(ans)

Submission status: Time Limit Exceeded

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

mod = a % b / b
ans = int(a*n/b)-a*int(n/b)
for i in range(n)[::-1]:
    tmp = int(a * i / b) - a * int(i / b)
    ans = max(ans, tmp)


print(ans)

Submission status: Time Limit Exceeded

Solution code:
from math import floor

tmp = input().split(' ')
A, B, N = [int(s) for s in tmp]

span = range(1, N+1)
result = 0

for i in span:
  answer = floor(A*i/B) - A * floor(i/B)
  if answer > result:
    result = answer

print(result)

Submission status: Time Limit Exceeded

Solution code:
import math

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

for x in range(n+1):
  c = math.floor(a*x/b)-a*(math.floor(x/b))
  if c > ans:
    ans = c

print(ans)

Submission status: Time Limit Exceeded

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

m=0
def cal(x):
    return a*x//b-a*(x//b)
for i in range(1,n+1):
    m=max(m,cal(i))
print(m)

Submission status: Time Limit Exceeded

Solution code:
import math

a,b,n=map(int,input().split(' '))
ans=0
for x in range(1,n+1):
    q=math.trunc(a*x/b)-a*math.trunc(x/b)
    if ans<q:
        ans=q
print(int(ans))

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
def main():
    a, b, n = map(int, input().split())
    max = 0
    for x in range(n+1):
        num = (a*x)/b//1 - a * ((x/b)//1)
        if num > max:
            max = num
    print(int(max))
    
if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

max = 0

for x in range(N + 1):
    floor = int(A * x / B) - A * int(x / B)
    if max < floor:
        max = floor

print(max)

Submission status: Time Limit Exceeded

Solution code:
a,b,n=map(int,input().split())
m=0
d=1
if n>=10**5:
    d=2
for i in range(1,n+1,d):
    c=a*i//b-a*(i//b)
    if c>=m:
        m=c
    # print((a*i)//b,a*(i//b),a*i//b-a*(i//b))
print(m)

Submission status: Time Limit Exceeded

Solution code:
from math import floor
a,b,n = map(int,input().split())
if a == 1:
    print(0)
    exit()

prev = 0
for x in range(1,n+1):
    val = floor(a*x/b) - a*floor(x/b)
    if val < prev:
        print(prev)
        exit()
    prev = val
print(prev)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
A, B, N = map(int,input().split())
MAX = -10**18
d = min(B,N)
for i in range(0,d+1):
    a = (A *i) //B -A * (i//B)
    MAX = max(a,MAX)
print(MAX)

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, int(a * x / b) - a * int(x / b))

print(ans)

Submission status: Time Limit Exceeded

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

m=-1
x=0

for i in range(1,n+1):
  c=int(a*i/b)-a*int(i/b)

  if m<c or m==-1:
    m=c
    x=i

print(m)

Submission status: Time Limit Exceeded

Solution code:
import math

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

m=0

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

print(m)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

if B > N:
    result = int(A * N / B) - A * int(N / B)
    
else:
    tmp = 0
    result = 0
    for i in range(B - 1, N, B):
        tmp = int(A * i / B) - A * int(i / B)
        if result < tmp:
            result = tmp

print(result)

Submission status: Time Limit Exceeded

Solution code:
a,b,n=map(int,input().split())
m=0
d=1
if n>=10**6:
    d=2
for i in range(1,n+1,d):
    c=a*i//b-a*(i//b)
    if c>=m:
        m=c
    # print((a*i)//b,a*(i//b),a*i//b-a*(i//b))
print(m)

Submission status: Time Limit Exceeded

Solution code:
a,b,n = map(int,input().split())
temp = min(b,n)
while temp:
    if temp%b:
        print((a*temp)//b)
        break
    n-=1

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
from math import floor

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

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import math

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

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

Submission status: Time Limit Exceeded

Solution code:
A,B,N=[int(s) for s in input().split()]
x=B-1
ans=set()
while x<N:
  ans.add((A*x)//B-A*(x//B))
  x+=B
ans.add((A*N)//B-A*(N//B))
print(max(ans))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

ans = []

for i in range(1, N+1):
    ans.append(((A*i)//B) - A*(i//B))

print(max(ans))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

for i in range(N+1):
  ans = (A*i)//B - A*(i//B)
  if (ans > bst):
    bst = ans

print(bst)

Submission status: Time Limit Exceeded

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


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

Submission status: Time Limit Exceeded

Solution code:
import math
a,b,n=map(int,input().split())
max=-2
for i in range(1,n+1):

    s=math.floor(a*i/b)-a*math.floor(i/b)
    if s>max:
        max=s
    if max==a/b:
        continue
print(max)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import sys
input = sys.stdin.readline
import random
import copy
import math
def main():
     A,B,N = map(int,input().split())
     ma = 0#math.floor(A/B)-A*math.floor(1/B)
     for x in range(1,min(B+1,N+1)):
          ma = max(ma,math.floor(A*x/B)-A*math.floor(x/B))
     print(ma)
                    
main()

Submission status: Time Limit Exceeded

Solution code:
mod = 10**9+7
import sys
from collections import Counter, defaultdict, deque
from itertools import product, permutations, combinations
from itertools import accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from math import ceil,floor
from copy import deepcopy
from heapq import heappop,heappush,heapify
import heapq


# l = ['a', 'a', 'a', 'a', 'b', 'c', 'c']
# c = Counter(l)

# d = defaultdict(int)

sys.setrecursionlimit(10 ** 6)

int1 = lambda x: int(x) - 1

# リストの要素を改行を挟んで表示する
p2D = lambda x: print(*x, sep="\n")
# 入力を整数に変換して受け取る
def II(): return int(sys.stdin.readline())

def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())

# 入力全てを整数に変換したものの配列を受け取る
# def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI(): return list(map(lambda x:int(x), sys.stdin.readline().split()))
def HI(): return list(map(lambda x:int(x)*(-1), sys.stdin.readline().split()))



a,b,n = MI()
ans = 0
for i in range(1,n+1):
	tmp = floor((a*i)/b) - a*floor(i/b)
	ans=max(tmp,ans)
print(ans)
# n,m,q = MI()
# A =[]
# B = []
# C = []
# D = []

# for _ in rage(q):
# 	a,b,c,d = MI()
# 	A.append(a)
# 	B.append(b)
# 	C.append(c)
# 	D.append(d)

# for i in range(n):

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):
  if ans < (math.floor(A*i/B) - A*math.floor(i/B)):
    ans = math.floor(A*i/B) - A*math.floor(i/B)
    
print(ans)

Submission status: Time Limit Exceeded

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

max_ = (A*0)//B - A * (0//B)

for num in range(1, N+1):
  ans = (A*num)//B - A * (num//B)
  if ans > max_:
    max_ = ans
print(max_)

Submission status: Time Limit Exceeded

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

for i in range(N):
  ans = (A*(i+1))//B - A*((i+1)//B)
  if (ans > bst):
    bst = ans
print(bst)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import math

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

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

i = 1
max_x = -9999999
max = -9999999
while (i <= N):
    ans =func(A, B, i) 
    if (ans > max):
        max = ans
        max_x = i
    i += 1

print(max)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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




max=0

for i in range(1,N+1):
    ma=A*i//B-A*(i//B)
    if(ma>max):
        max=ma

print(max)

Submission status: Time Limit Exceeded

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

import math

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

    max_ans = 0

    for x in range(n+1):
        buff = math.floor(a*x/b) - a*math.floor(x/b)
        if buff > max_ans:
            max_ans = buff

    print(max_ans)

if __name__ == '__main__':
    main()