Problem: Given are integers A, B, and N.  Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N.  Here floor(t) denotes the greatest integer not greater than the real number t.

Submission attempts (in order):
# -*- coding: utf-8 -*-
import sys
import itertools
import fractions
import copy
import bisect
import math
import numpy as np


#w=input()
from operator import itemgetter
from sys import stdin

from operator import mul
from functools import reduce
from collections import Counter
#from collections import deque

#input = stdin.readline


N=3
M=3
i=0
j=0
k=0
n=3
r=1
a=[0]*5
b=[]
#n=int(input())
#r=int(input())
#print(M)
#A=int(input())
#B=int(input())
#print(N)
pre=0

"1行1つの整数を入力を取得し、整数と取得する"
A,B,N=map(int, input().split(" "))
syo=len(str(N))
if syo <10**4:
 for i in range(N+1):
    k=(A*(i//B))-A*(i//B)
    if pre > k :
        print(pre)
        sys.exit()
    pre=k
    b.append(k)
    k=0
for i in range(N+1):
        k=(A*(i+10**(syo-1))//B)-A*((i+10**(syo-1))//B)
        #print(pre,k)
        if pre > k:
            #print(pre)
            sys.exit()
        pre=k
        b.append(k)
        k=0

print(max(b))

#print(number_list)
"12 21 332 とか入力する時に使う"
"1行に複数の整数の入力を取得し、整数として扱う"

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''








#print(type(brray[0][0]))
#print(brray)

"列数に関して自由度の高いint型の値を入力するタイプの行列"


'''
table = [[int(i) for i in input().split()] for m in range(m)]

print(type(N))
print(N)
print(type(M))
print(M)

print(type(table))
print(table)
'''




#s=input()

#print(a[0])
#print([a])















#a= stdin.readline().rstrip()
#print(a.upper())
"aという変数に入っているものを大文字にして出力"





#a=[[int(i) for i in 1.strip()]for 1 in sys.stdin]
#a = [[int(c) for c in l.strip()] for l in sys.stdin]]
#print(a)



##############################################################################################
##############################################################################################
#under this line explains example calculation



#nCr combination
'''
def cmb(n,r):
    #When n < r , this function isn't valid
    r= min(n-r,r)
    #print(n,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n-r, -1))
    #flochart mul(n,n-1)=x
    #next     mul(x,n-2)........(n-r+1,n-r)
    #mul read a,b and returns a*b

    under = reduce(mul, range(1, r+1))
    #print(over, under)
    #reduce is applied mul(1,2)=2
    #next   mul(2,3)=6
    #next   mul(6,4)=4.........last(r!,r+1)=r+1!

    return over // under
    #// is integer divide
    #calc example 5C2
    #over=5*4*3
    #under=3*2*1
a = cmb(n, r)
#print(a)
'''





#A = [1, 2, 3, 3, 3, 4, 4, 6, 6, 6, 6]
#print(A)

#A.insert(index, 5)
#print(index)
#print(A)






########################################################################
########################################################################

#print(b2)



#print(b3)


# -*- coding: utf-8 -*-
import sys
import itertools
import fractions
import copy
import bisect
import math
import numpy as np


#w=input()
from operator import itemgetter
from sys import stdin

from operator import mul
from functools import reduce
from collections import Counter
#from collections import deque

#input = stdin.readline


N=3
M=3
i=0
j=0
k=0
n=3
r=1
a=[0]*5
b=[]
#n=int(input())
#r=int(input())
#print(M)
#A=int(input())
#B=int(input())
#print(N)
pre=0

"1行1つの整数を入力を取得し、整数と取得する"
A,B,N=map(int, input().split(" "))
syo=len(str(N))
if syo <10**4:
 for i in range(N+1):
    k=((A*i)//B))-A*(i//B)
    if pre > k :
        print(pre)
        sys.exit()
    pre=k
    b.append(k)
    k=0
for i in range(N+1):
        k=(A*(i+10**(syo-1)))//B-A*((i+10**(syo-1))//B)
        #print(pre,k)
        if pre > k:
            print(pre)
            sys.exit()
        pre=k
        b.append(k)
        k=0

print(max(b))

#print(number_list)
"12 21 332 とか入力する時に使う"
"1行に複数の整数の入力を取得し、整数として扱う"

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''








#print(type(brray[0][0]))
#print(brray)

"列数に関して自由度の高いint型の値を入力するタイプの行列"


'''
table = [[int(i) for i in input().split()] for m in range(m)]

print(type(N))
print(N)
print(type(M))
print(M)

print(type(table))
print(table)
'''




#s=input()

#print(a[0])
#print([a])















#a= stdin.readline().rstrip()
#print(a.upper())
"aという変数に入っているものを大文字にして出力"





#a=[[int(i) for i in 1.strip()]for 1 in sys.stdin]
#a = [[int(c) for c in l.strip()] for l in sys.stdin]]
#print(a)



##############################################################################################
##############################################################################################
#under this line explains example calculation



#nCr combination
'''
def cmb(n,r):
    #When n < r , this function isn't valid
    r= min(n-r,r)
    #print(n,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n-r, -1))
    #flochart mul(n,n-1)=x
    #next     mul(x,n-2)........(n-r+1,n-r)
    #mul read a,b and returns a*b

    under = reduce(mul, range(1, r+1))
    #print(over, under)
    #reduce is applied mul(1,2)=2
    #next   mul(2,3)=6
    #next   mul(6,4)=4.........last(r!,r+1)=r+1!

    return over // under
    #// is integer divide
    #calc example 5C2
    #over=5*4*3
    #under=3*2*1
a = cmb(n, r)
#print(a)
'''





#A = [1, 2, 3, 3, 3, 4, 4, 6, 6, 6, 6]
#print(A)

#A.insert(index, 5)
#print(index)
#print(A)






########################################################################
########################################################################

#print(b2)



#print(b3)


# -*- coding: utf-8 -*-
import sys
import itertools
import fractions
import copy
import bisect
import math
import numpy as np


#w=input()
from operator import itemgetter
from sys import stdin

from operator import mul
from functools import reduce
from collections import Counter
#from collections import deque

#input = stdin.readline


N=3
M=3
i=0
j=0
k=0
n=3
r=1
a=[0]*5
b=[]
#n=int(input())
#r=int(input())
#print(M)
#A=int(input())
#B=int(input())
#print(N)
pre=0

"1行1つの整数を入力を取得し、整数と取得する"
A,B,N=map(int, input().split(" "))
syo=len(str(N))
if syo <10**4:
 for i in range(N+1):
    k=(A*(i//B))-A*(i//B)
    if pre > k :
        print(pre)
        sys.exit()
    pre=k
    b.append(k)
    k=0
for i in range(N+1):
        k=(A*(i+10**(syo-1))//B)-A*((i+10**(syo-1))//B)
        #print(pre,k)
        if pre > k:
            print(pre)
            sys.exit()
        pre=k
        b.append(k)
        k=0

print(max(b))

#print(number_list)
"12 21 332 とか入力する時に使う"
"1行に複数の整数の入力を取得し、整数として扱う"

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''








#print(type(brray[0][0]))
#print(brray)

"列数に関して自由度の高いint型の値を入力するタイプの行列"


'''
table = [[int(i) for i in input().split()] for m in range(m)]

print(type(N))
print(N)
print(type(M))
print(M)

print(type(table))
print(table)
'''




#s=input()

#print(a[0])
#print([a])















#a= stdin.readline().rstrip()
#print(a.upper())
"aという変数に入っているものを大文字にして出力"





#a=[[int(i) for i in 1.strip()]for 1 in sys.stdin]
#a = [[int(c) for c in l.strip()] for l in sys.stdin]]
#print(a)



##############################################################################################
##############################################################################################
#under this line explains example calculation



#nCr combination
'''
def cmb(n,r):
    #When n < r , this function isn't valid
    r= min(n-r,r)
    #print(n,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n-r, -1))
    #flochart mul(n,n-1)=x
    #next     mul(x,n-2)........(n-r+1,n-r)
    #mul read a,b and returns a*b

    under = reduce(mul, range(1, r+1))
    #print(over, under)
    #reduce is applied mul(1,2)=2
    #next   mul(2,3)=6
    #next   mul(6,4)=4.........last(r!,r+1)=r+1!

    return over // under
    #// is integer divide
    #calc example 5C2
    #over=5*4*3
    #under=3*2*1
a = cmb(n, r)
#print(a)
'''





#A = [1, 2, 3, 3, 3, 4, 4, 6, 6, 6, 6]
#print(A)

#A.insert(index, 5)
#print(index)
#print(A)






########################################################################
########################################################################

#print(b2)



#print(b3)


# -*- coding: utf-8 -*-
import sys
import itertools
import fractions
import copy
import bisect
import math
import numpy as np


#w=input()
from operator import itemgetter
from sys import stdin

from operator import mul
from functools import reduce
from collections import Counter
#from collections import deque

#input = stdin.readline


j=0
k=0
n=3
r=1
a=[0]*5
b=[]
#n=int(input())
#r=int(input())
#print(M)
#A=int(input())
#B=int(input())
#print(N)
"1行1つの整数を入力を取得し、整数と取得する"



#print(number_list)
"12 21 332 とか入力する時に使う"
"1行に複数の整数の入力を取得し、整数として扱う"

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''








#print(type(brray[0][0]))
#print(brray)

"列数に関して自由度の高いint型の値を入力するタイプの行列"


'''
table = [[int(i) for i in input().split()] for m in range(m)]

print(type(N))
print(N)
print(type(M))
print(M)

print(type(table))
print(table)
'''




#s=input()

#print(a[0])
#print([a])















#a= stdin.readline().rstrip()
#print(a.upper())
"aという変数に入っているものを大文字にして出力"





#a=[[int(i) for i in 1.strip()]for 1 in sys.stdin]
#a = [[int(c) for c in l.strip()] for l in sys.stdin]]
#print(a)



##############################################################################################
##############################################################################################
#under this line explains example calculation



#nCr combination
'''
def cmb(n,r):
    #When n < r , this function isn't valid
    r= min(n-r,r)
    #print(n,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n-r, -1))
    #flochart mul(n,n-1)=x
    #next     mul(x,n-2)........(n-r+1,n-r)
    #mul read a,b and returns a*b

    under = reduce(mul, range(1, r+1))
    #print(over, under)
    #reduce is applied mul(1,2)=2
    #next   mul(2,3)=6
    #next   mul(6,4)=4.........last(r!,r+1)=r+1!

    return over // under
    #// is integer divide
    #calc example 5C2
    #over=5*4*3
    #under=3*2*1
a = cmb(n, r)
#print(a)
'''





#A = [1, 2, 3, 3, 3, 4, 4, 6, 6, 6, 6]
#print(A)

#A.insert(index, 5)
#print(index)
#print(A)






########################################################################
########################################################################

#print(b2)



#print(b3)


input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)



def main():
    A, B, N = map(int, input().split())
    x=min(B-1,N)
    k=((A*x)//B)-A*(x//B)
    print(k)


if __name__ == "__main__":
    main()


Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Accepted