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:
# coding:utf-8
def main():
    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(tmp, ans)

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

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

for x in range(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:
a, b, n = map(int, input().split())

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

print(M)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
import sys
import os
import math

def file_input():
    f = open('../Beginner_Contest_165/input.txt', 'r')
    sys.stdin = f

def main():
    #file_input()
    # input()
    A,B,N=map(int, input().split())

    max=0.0
    for x in range(N+1):
        # ans=int(A*x/B)-A*int(x/B)
        min,_=math.modf(x/B)
        # ans=int(A*min)
        # print(min)
        if x==0:
            max=min
        elif min > max:
            max=min
        else:
            break

    print(int(max*A))

if __name__ == '__main__':
    main()

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,(a*i)//b-a*(i//b))
  if a*(i//b)!=0:
    break
print(ans)

Submission status: Time Limit Exceeded

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

x = n
max_ = -1
for i in range(b):
	if x < 1:
		break
	max_ = max(a * x // b - a * (x // b), max_)
	#print(max_, x)
	x -= 1
print(max_)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import sys
import math

if __name__ == '__main__':
    a, b, n = list(map(lambda x: int(x), sys.stdin.readline().split(' ')))
    old = 0

    for x in range(n+1):
        tmp = math.floor(a*x/b)-a*math.floor(x/b)
        if tmp < old:
            print(old)
            break
        else:
            old = tmp
    else:
        print(tmp)

Submission status: Time Limit Exceeded

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

tmp = 0
for i in range(B - 1, N + 1, B):
    if (s := (A * i) // B - A * (i // B)) > 0:
        tmp = max(s, tmp)
    else:
        break
    
for i in range(N, N - N % B - 1, -1):
    tmp = max((A * i) // B - A * (i // B), tmp)

print(tmp)

Submission status: Time Limit Exceeded

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

x=N
dammy=[]
while x > N//(1.1):
    dammy.append((A*x)//B - A * int(x/B))
    x = x -1
print(max(dammy))

Submission status: Time Limit Exceeded

Solution code:
A, B, N = map(int,input().split())
fivex = 0
i = 1
ans = 0
x = 0
while x <= N:
    x = -((-1)*i*B // A)
    if x > N:
        break
    now = i - A *  int(x / B)
    if now > ans and x <= N:
        ans = now
    i += 1

print(ans)

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

print(ans)

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().strip().split())
list = []
for i in range(1, n+1):
    max1 = math.floor(a*i/b)-(a*math.floor(i/b))
    list.append(max1)
print(max(list))

Submission status: Time Limit Exceeded

Solution code:
if __name__ == '__main__':
    a, b, n = map(int, input().split())
    m = 0
    for x in range(1, n+1):
        if m < (a*x)//b - a*(x//b):
            m = (a*x)//b - a*(x//b)
        x += 1
    print(m)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

ans=[]
if n%t!=0:
    n%=t

for i in range(1,n+1):
    y=int(a*i/b)-a*int(i/b)
    ans.append(y)


print(max(ans))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

ans = -1
for x in range(n//2,n+1):
    abc = ((a*x)//b)-(a*(x//b))
    if(ans < abc):
        ans = abc

print(ans)

Submission status: Time Limit Exceeded

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

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]

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

def main():
    A,B,N = MI()
    max = 0
    #print(a(A,B,x))
    for x in range(0, N+1):
        if max < a(A,B,x):
            max = a(A,B,x)
    
    print(max)



    


if __name__ == "__main__":
	main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import math 

a, b, n = map(int, input().split())
if n < b:
    print(math.floor(a*n/b))
else:
    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:
# D - Floor Function

from math import floor

A, B, N = map(int, input().split())
mx = -1 * float('inf')
i = 0

for i in range(N + 1):
    result = floor(A * i / B) - A * floor(i / B)
    if mx <= result:
        mx = result

print(mx)

Submission status: Time Limit Exceeded

Solution code:
import math
import numpy as np
d=list(map(int,input().split()))
a=d[0]
b=d[1]
n=d[2]
maxim=0
for i in range(n+1):
  maximy=(math.floor(a*i/b)-a*math.floor(i/b))
  maxim=np.where(maxim<maximy,maximy,maxim)
print(maxim)

Submission status: Time Limit Exceeded

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

x=N
dammy=[]
while x > N//(1.5):
    dammy.append((A*x)//B - A * int(x/B))
    x = x -1
print(max(dammy))

Submission status: Time Limit Exceeded

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

ans = 0
if b > n:
    x = n
    ans = int(a * x // b) - int(a * (x // b))
else:
    m = 0
    for i in range(b):
        if int(a * (n - i) // b) - int(a * ((n - i) // b)) > m:
            m = int(a * (n - i) // b) - int(a * ((n - i) // b))
    ans = m
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

def calc(a, b, x):
    # print(a, b, x, math.floor(a*x/b), math.floor(x/b))
    return math.floor(a*x/b) - a * math.floor(x/b)
    
ans = -1
for x in range(1, n+1):
    r = calc(a, b, x)
    if r > ans:
        ans = r
        # print(x)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
from math import floor,sqrt
import sys
a,b,n=map(int,input().split())
max=-sys.maxsize
#max=floor(a*n/b)-a*floor(n/b)
for i in range(n,int(sqrt(n))-1,-1):
	t=floor(a*i/b)-a*floor(i/b)
#	print(t)
	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())
ans = 0
if B-1 <=  N:
  for x in range(B-1,N+1,B):
    ans = max(ans, floor(A*x/B) - A*floor(x/B))
else:
  ans = floor((A*N)/B) - A*floor(N/B)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
def main():
    import sys
    import math
    input = sys.stdin.readline
    A,B,N=map(int,input().split())
    Z=0
    for x in range(N+1):
        Y=int(A*x/B)-A*int(x/B)
        if Z<=Y:
            Z=Y
    print(Z)    

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
from math import floor

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

mv = 0
while N > 0:
    mv = max(mv, floor(A*N/B) - A*floor(N/B))
    N -= 1

print(mv)

Submission status: Time Limit Exceeded

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

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

ans = 0
for i in range(1, min(B, N)+1):
    ans = max(ans, f(i))
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math
l = list(map(int, input().split()))
def fn(a,b,i):
    temp = ((math.floor((a/b)*i)) - (a * math.floor(i/b)))
    return temp

maxt = 0
for i in range(l[2]+1):
    t = fn(l[0],l[1],i)
    if t > maxt:
        maxt = t
print(maxt)

Submission status: Time Limit Exceeded

Solution code:
import math

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

n = min(n, 10**12)

num = 0
for x in range(1, n+1):
    if num <= math.floor(a*x/b) - a*math.floor(x/b):
        num = math.floor(a*x/b) - a*math.floor(x/b)
    else:
        break

print(num)

Submission status: Time Limit Exceeded

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

tmp_pre = 0
for i in range(1, N+1):
  tmp = (A*i)//B - A*(i//B)
  if tmp > tmp_pre:
    tmp_pre = tmp
print(int(tmp_pre))

Submission status: Time Limit Exceeded

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

x = list()
for i in range(n):
  y = int(a*(i+1)/b) - a*int((i+1)/b)
  x.append(y)

z = sorted(x)
print(z[-1])

Submission status: Time Limit Exceeded

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

maxNum = 0
x = 1
while x <= N:
  num = math.floor(A * x // B) - A * math.floor(x // B)
  x += 1
  if num >= maxNum:
    maxNum = num

print(maxNum)

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)
#print(left)
li = [i for i in range(left,N+1) ]
m = 0
for i in li:
    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())
max = 0
for i in range(n+1):
    score = int(a*i/b) - a*int(i/b)
    if score > max:
        max = score

print(max)

Submission status: Time Limit Exceeded

Solution code:
import math

a, b, n = map(int,input().split())
x = 0
for i in range(n+1):
  if math.floor(i/b) > 0:
    break
  else:
    y = math.floor((a*i)/b) - a * math.floor(i/b)
    if x < y:
      x = y
print(y)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import sys
import os
import math

def file_input():
    f = open('../Beginner_Contest_165/input.txt', 'r')
    sys.stdin = f

def main():
    #file_input()
    # input()
    A,B,N=map(int, input().split())

    max=0.0
    for x in range(N+1):
        # ans=int(A*x/B)-A*int(x/B)
        min,_=math.modf(x/B)
        # ans=int(A*min)
        if min > max:
            max=min
        elif min < max:
            break

    print(int(max*A))

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

a,b,n = map(int,input().split())
print(max([f(a,b,x) for x in range(1,n+1)]))

Submission status: Time Limit Exceeded

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

import sys
import math
import bisect

debug = False

def log(text):
    if debug:
        print(text)


def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        # for line in sys.stdin:
        #     lines.append(line)
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]
    
    (a, b, n) = [int(e) for e in lines[0].split(' ')]

    return (a, b, n)


def solve(a, b, n):

    result = 0
    for i in range(1, n + 1):
        tmp = math.floor(a * i / b) - a * math.floor(i / b)
        if tmp > result:
            result = tmp

    return result

def main():
    # 出力
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3
# n,m = map(int,sys.stdin.readline().split())
# a = list(map(int,sys.stdin.readline().split()))
# a = [sys.stdin.readline() for _ in range(n)]
# s = sys.stdin.readline().rstrip()
# n = int(sys.stdin.readline())
import sys,bisect,math
sys.setrecursionlimit(15000)

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

m = -float("inf")
for i in range(N+1):
    m = max(m,math.floor(A*i/B)-A*math.floor(i/B))
print(m)
# x = B//2
# print(math.floor(A*x/B)-A*math.floor(x/B))

Submission status: Time Limit Exceeded

Solution code:
A, B, N = list(map(int,input().split()))
def max_val(a, b, n):
  pat = [ i for i in range(b-1, n+1, b)]
  maxv = 0
  for x in pat+[n]:
    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())
n1 = 0
n2 = 0
for i in range(n+1):
  n1 = math.floor(a*i/b)-5*math.floor(i/b)
  if n1 >= n2:
    n2 = n1
print(n2)

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

Submission status: Time Limit Exceeded

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

ans = 0

for x in range(n+1):
    f_1 = a*x//b
    f_2 = x//b
    f_3 = f_1 - a*f_2
    if f_3 > ans:
        ans = f_3
        continue

print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math

data = str(input())
data = data.split(" ")

results = []
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
  results.append(result)
print(max(results))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

tmp = 0
for i in range(B - 1, N + 1, B):
    tmp = max((A * i) // B - A * (i // B), tmp)
    
for i in range(N, N - N % B - 1, -1):
    tmp = max((A * i) // B - A * (i // B), tmp)

print(tmp)

Submission status: Time Limit Exceeded

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

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

print(max(result))

Submission status: Time Limit Exceeded

Solution code:
A, B, N = map(int, input().split())
max = 0
flag = False
for i in range(N + 1):
    tmp = int(float(A) * i / B) - A * int(float(i) / B)
    if tmp > 0 and flag is False:
        flag = True
    if tmp > max:
        max = tmp
    if tmp == 0 and flag is True:
        break
print(max)

Submission status: Time Limit Exceeded

Solution code:
ABN = [int(x) for x in input().split()]
y=0
n=[]
for i in range(1,int((ABN[2]+1)/ABN[1])+1):
  n.append(ABN[1]*i-1)
if len(n)==0:
  n.append(ABN[2])
for x in n:
  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 = list(map(int, input().split(" ")))

def tgt(A,B,d):
    return math.floor(A * d / B) - A * math.floor(d/B)

if N >= B-1:
    d_max = B-1
else: # N< B-1
    d_max = N

ret = 0
for d in range (d_max+1):
    tmp = tgt(A,B,d)
    if ret <= tmp:
        ret = tmp

print(ret)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

def f(x):
    return (A*x)//B - A*(x//B)
    #return floor(A*x/B) - A*floor(x/B)
if B > N:
    print(f(N))
    exit()

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

Submission status: Time Limit Exceeded

Solution code:
A, B, N = [eval(v) for v in input().strip().split(" ")]

max_value = -99999

for x in range(1, N + 1):
    value = int(A * x / B) - A * int(x / B)
    max_value = value if value > max_value else max_value
print(max_value)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import math

a,b,n=map(int,input().split())
maxtemp=0
teisuu=100000
def funcsum(x):

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

for i in range(n):
    #if i>teisuu:
    #    break
    temp=n-i
    maxtemp=max(maxtemp,funcsum(temp))


print(maxtemp)

#items=[int(i) for i in input().split()]


#items=[i for i in range(n+1)]

Submission status: Time Limit Exceeded

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

    if ans <= f:
        ans = f
print(int(ans))

Submission status: Time Limit Exceeded

Solution code:
a,b,n = map(int,input().split())
u=0
for i in range(n+1):
    if((((a*i)//b) - (a *(i//b))) == 0 and u != 0):
        break
    u = max((((a*i)//b) - (a *(i//b))),u)

print(u)

Submission status: Time Limit Exceeded

Solution code:
a,b,n = map(int,input().split())
x = 0
m = []
while x<=n:
  k = (a*x)//b - a*(x//b)
  m.append(k)
  x += 1
m.sort()
print(m[-1])

Submission status: Time Limit Exceeded

Solution code:
import sys
input = sys.stdin.readline
a,b,n = map(int,input().split())
li = []

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

Submission status: Time Limit Exceeded

Solution code:

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

mx = 0

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

Submission status: Time Limit Exceeded

Solution code:
line = input().split(" ")
A = int(line[0])
B = int(line[1])
N = int(line[2])
max = 0
for x in reversed(range(N+1)):
    S = int(A * x / B) - A * int(x / B)
    
    if max<S:
        max = S
    if int(x/B) == 0:
        break
print(max)

Submission status: Time Limit Exceeded

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

from math import floor
result = []
for i in range(n):
    x = i+1
    val = a*x//b - a*(x//b)
    result.append(val)

print(max(result))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
from math import floor

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

Submission status: Time Limit Exceeded

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

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

print(max)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
a, b, n = map(int,input().split())
def ans():
    max = 0
    i = 0
    while i <=n:
        result =  int((a*i)/b) - a*int(i/b)
        i +=1
        if result > max:
            max = result
    print(max)

ans()

Submission status: Time Limit Exceeded

Solution code:
import math
import sys
input = sys.stdin.readline
a,b,n = map(int,input().split())
li = []

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

Submission status: Time Limit Exceeded

Solution code:
import math

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

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math
ABN=input().split()
A=int(ABN[0])
B=int(ABN[1])
N=int(ABN[2])
max=0
for i in range(1,N+1):
    tmp=A*i//B-A*(i//B)
    if(tmp>max):
        max=tmp
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(1,n+1):
    k=math.floor(a*i/b)-a*math.floor(i/b)
    kai.append(k)
print(max(kai))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

ans = 0
for x in range(1,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())


x = 2

def hantei(x,a,b):
    rr = 0
    rr = int(a*x//b) - a * int(x//b)
    return rr



mx = n//b
ans = 0
ans_n = hantei(n,a,b)
ans_0 = hantei(0,a,b)

if(mx == 0):
    x = n
    ans = hantei(x,a,b)
else:
    flag = 1
    for i in range(1,mx+1):
        x = i*b - 1
        ans = max(ans,hantei(x,a,b))

asn = max(ans,ans_n,ans_0)    
print(ans)

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
# Your code here!

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

def check(x):
    return int(a*x/b)-a*int(x/b)
    
preans=0
for i in range(n,0,-1):
    ans=check(i)
    if(ans<preans):
        continue
    preans=ans
print(preans)

Submission status: Time Limit Exceeded

Solution code:
import math
A,B,N = map(int,input().split())
ans,point = 0,0
looked = min(B-1,N)
i = 2
while(looked <= N):
    point = (A*looked)//B - A*(looked//B)
    ans = max(ans,point)
    looked = i*B-1
    i += 1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math
l = list(input().split(" "))
a = int(l[0])
b = int(l[1])
n = int(l[2])
def f(x):
  return math.floor(x)
def c(x):
    return f(a*x/b) - a*f(x/b)
e = c(1)
for i in range(2,n+1):
  d = c(i)
  if e >= d:
    e = e
  else:
    e = float(d)
print(int(e))

Submission status: Time Limit Exceeded

Solution code:
# import sys
# import math #sqrt,gcd,pi
# import decimal
# import queue # queue
# import bisect
# import heapq # priolity-queue
# import time
# from itertools import product,permutations,\
#     combinations,combinations_with_replacement
# 重複あり順列、順列、組み合わせ、重複あり組み合わせ
# import collections # deque
# from operator import itemgetter,mul
# from fractions import Fraction
# from functools import reduce

mod = int(1e9+7)
INF = 1<<29
lINF = 1<<35

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

def main():
    a,b,n = readInt()
    x = min(b-1,n)
    ans = 0
    while x<=n:
        res = a * x // b - a * (x // b)
        ans = max(ans,res)
        x += b-1
    print(ans)
    return

if __name__=='__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
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:
import math
A,B,N = map(int,input().split())
lst = []
x = 1
for i in range(1,N+1):
    c = math.floor(A*x/B) - A * math.floor(x/B)
    lst.append(c)
    x += 1
print(max(lst))

Submission status: Time Limit Exceeded

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

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

ans = 0
for x in range(N+1):
    q, r = divmod(x, B)
    ans = max(ans, (A*r)//B - (A-1)*q)
    # 終了判定
    if ans == B-1:
        break

print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
def main():
    a, b, n = [int(x) for x in input().split()]
    gen = (a * x // b - x // b * a for x in range(min(b, n) + 1))
    return max(gen)


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

Submission status: Time Limit Exceeded

Solution code:
import math

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

for i in range(math.floor(N / 2), N + 1):
  s = math.floor(A * i / B) - A * math.floor(i / B)
  if s > max(l):
    l.append(s)
  else:
    pass
print(max(l))

Submission status: Time Limit Exceeded

Solution code:
if __name__ == '__main__':
    a, b, n = map(int, input().split())
    m = 0
    for x in range(1, n+1):
        p = (a*x)//b - a*(x//b)
        x += 1
        if m < p:
            m = p
    print(m)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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