input
stringlengths
20
127k
target
stringlengths
20
119k
problem_id
stringlengths
6
6
a,b,n = list(map(int, input().split())) ans = 0 for i in range(1, n+1): t = (a*i//b) - a*(i//b) ans = max(ans,t) print(ans)
a,b,n = list(map(int, input().split())) x = min(b-1, n) print((a*x//b -a*(x//b)))
p02696
a,b,n = list(map(int, input().split())) if n >= b-1: print((a*(b-1)//b - a*((b-1)//b))) else: ans = 0 for x in range(1,n+1): ans = max(ans, int(a*x/b) - a*int(x/b)) print(ans)
a,b,n = list(map(int, input().split())) x = min(b-1, n) print((a*x//b - a*(x//b)))
p02696
a,b,n = list(map(int, input().split())) x = min(b-1, n) print((a*x//b - a*(x//b)))
a,b,n = list(map(int, input().split())) x = min(n, b-1) print((int(a*x//b) - a*(x//b)))
p02696
import math a,b,n = list(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)
import math a,b,n = list(map(int,input().split())) if n >= b-1: print((math.floor(a*(b-1)/b) - a*math.floor((b-1)/b))) else: print((math.floor(a*n/b) - a*math.floor(n/b)))
p02696
import math A, B, N = list(map(int, input().split())) ans = 0 for x in range(N+1): tmp = math.floor(A*x/B) - A*math.floor(x/B) if tmp < ans: break ans = tmp print(ans)
import math A, B, N = list(map(int, input().split())) def f(x): return math.floor(A*x/B) - A * math.floor(x/B) print((f(min(B-1, N))))
p02696
import math a,b,n=list(map(int,input().split())) max=-2 if n<b: max=math.floor(a*n/b) else: #b<=n max=math.floor(a*(b-1)/b) for i in range(b,n+1): s2=math.floor(a*((1/b)-i//b)) if max<s2: max=s2 print(max)
import math a,b,n=list(map(int,input().split())) max=-2 if n<b: max=math.floor(a*n/b) else: #b<=n max=math.floor(a*(b-1)/b) print(max)
p02696
import math A,B,N = list(map(int,input().split())) ans = 0 for i in range(1,N+1): num = math.floor((A*i)/B) - A * math.floor(i / B) if ans < num: ans = num print(ans)
import math A,B,N = list(map(int,input().split())) m = min(B-1,N) num = math.floor((A*m)/B) - A * math.floor(m / B) print(num)
p02696
import math A,B,N=list(map(int,input().split())) start=0 for i in range(1,N+1): K=math.floor(((i/B)-(i//B))*A) if start<=K: start=K print(start)
import math A,B,N=list(map(int,input().split())) start=0 i=min(B-1,N) K=math.floor((A*i)/B)-A*(math.floor(i/B)) if start<=K: start=K print(start)
p02696
#n=int(input()) a,b,n=list(map(int,input().split())) #l=list(map(int,input().split())) #l=[list(map(int,input().split())) for i in range(n)] x=min(b-1,n) ans=(a*x)//b - a*(x//b) print(ans)
#n=int(input()) a,b,n=list(map(int,input().split())) #hl=list(map(int,input().split())) #l=[list(map(int,input().split())) for i in range(n)] x=min(n,b-1) print(((a*x)//b-a*(x//b)))
p02696
A, B, N = list(map(int, input().split())) def f(x): return int(A*x/B)-A*int(x/B) X = N Y = min(B-1,N) print((f(Y)))
A, B, N = list(map(int, input().split())) def f(x): return (A*x)//B-A*(x//B) X = N Y = min(B-1,N) print((max(f(X),f(Y))))
p02696
a,b,n=list(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)
a,b,n=list(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=max((a*(b-1))//b,(a*n)//b-a*(n//b)) print(m)
p02696
#!/usr/bin/env python3 def main(): import sys input = sys.stdin.readline A, B, N = list(map(int, input().split())) ans = 0 for x in range(N + 1): res = int((A * x) // B) - A * int(x // B) ans = max(ans, res) print(ans) if __name__ == '__main__': main()
#!/usr/bin/env python3 def main(): import sys input = sys.stdin.readline A, B, N = list(map(int, input().split())) x = min(B - 1, N) print(((A * x) // B - A * (x // B))) if __name__ == '__main__': main()
p02696
import math a,b,n=list(map(int,input().split())) li=[] for i in range(n+1): c=math.floor((a*i)/b)-(a*math.floor(i/b)) li.append(c) print((max(li)))
import math a,b,n=list(map(int,input().split())) d=min(n,b-1) c=math.floor((a*d)/b)-(a*math.floor(d/b)) print(c)
p02696
a, b, n = list(map(int, input().split())) if n < b: print((int((a*n)/b))) else: print((int((a*(b-1))/b)))
a, b, n = list(map(int, input().split())) if n < b: print((int(a*n/b))) else: print((int(a*(b-1)/b)))
p02696
import math a, b, n = list(map(int, input().split())) n = min(n, b) mem = {} m = 0 for x in range(1, n + 1): if mem.get(((a * x) % b, x % b)) is not None: break else: c = math.floor(a * x / b) - a * math.floor(x / b) mem[((a * x) % b, x % b)] = 1 m = max(m, c...
import math a, b, n = list(map(int, input().split())) n = min(n, b-1) print((math.floor(a * n / b) - a * math.floor(n / b)))
p02696
a, b, n = list(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)
a, b, n = list(map(int, input().split())) tmp = min(b-1, n) print((int(a*tmp/b)-a*int(tmp/b)))
p02696
import math from collections import deque a, b, n = list(map(int, input().split())) d = deque(list(math.floor(a*i/b)- a * math.floor(i/b) for i in range(1, n+1))) print((max(d)))
import math a, b, n = list(map(int, input().split())) x = min(b-1, n) ans = math.floor(a*x/b)- a * math.floor(x/b) print(ans)
p02696
# D - Floor Function a, b, n = list(map(int, input().split())) # max(floor(a * x / b) - a * floor(x / b) for 0 <= x <= n) # x = k * b のとき, 第1項 == 第2項 # k * b <= x < (k+1) * b のとき, 第1項は単調増加, 第2項は一定 x = min(n, b - 1) print((a * x // b - a * (x // b)))
# D - Floor Function a, b, n = list(map(int, input().split())) # max(floor(a * x / b) - a * floor(x / b) for 0 <= x <= n) # x = k * b のとき, 第1項 == 第2項 # k * b <= x < (k+1) * b のとき, 第1項は単調増加, 第2項は一定 x = min(n, b - 1) print((a * x // b))
p02696
import sys input = sys.stdin.readline import math def main(): a,b,n = list(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__...
import sys input = sys.stdin.readline import math def main(): a,b,n = list(map(int, input().split())) if b > n: print((math.floor(a*n/b) - a*math.floor(n/b))) else: print((math.floor(a*(b-1)/b) - a*math.floor((b-1)/b))) if __name__ == '__main__': main()
p02696
A,B,N=list(map(int,input().split())) x=0 while A*int(x/B)<1 and x<=N: x+=1 print((int((A*(x-1))/B)))
A,B,N=list(map(int,input().split())) x=B-1 print((int(A*x/B) if x<=N else int(A*N/B)))
p02696
A, B, N = list(map(int,input().split())) Max=(-1)*A for x in range(N+1): S= A*x//B T=x//B ans= S-A*T Max=max(Max,ans) print(Max)
A, B, N = list(map(int,input().split())) x = min(N,B-1) print((A*x//B))
p02696
import math a,b,n=list(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)
a,b,n = list(map(int,input().split())) x=min(b-1,n) ans=a*x//b-a*(x//b) print(ans)
p02696
def main(): import sys input = sys.stdin.readline A, B, N = list(map(int, input().split())) num = N//B score = 0 for x in range(1, N+1): tmp = int(A*x/B) - A*int(x/B) if score <= tmp: score = tmp print(score) if __name__ == "__main__": ma...
def main(): import sys input = sys.stdin.readline A, B, N = list(map(int, input().split())) x = min(B-1, N) print((int(A*x/B)-A*int(x/B))) if __name__ == "__main__": main()
p02696
import math a,b,n = list(map(int, input().split())) maxresult = 0 #for x in range(n+1): # if (a * x * 1.0 // b) - a * (x * 1.0 // b) >= maxresult: # maxresult = int((a * x * 1.0 // b) - a * (x * 1.0 // b)) for x in range(n+1): if a * math.modf(x*1.0/b)[0] >= maxresult: maxresult ...
import math a,b,n = list(map(int, input().split())) maxresult = 0 #これはタイムオーバー #for x in range(n+1): # if (a * x * 1.0 // b) - a * (x * 1.0 // b) >= maxresult: # maxresult = (a * x * 1.0 // b) - a * (x * 1.0 // b) #これもタイムオーバー #for x in range(n+1): # if a * math.modf(x*1.0/b)[0] >= maxresult...
p02696
a,b,n = list(map(int, input().split())) print((max([int(a*x/b)-a*int(x/b) for x in range(1,n+1)])))
a,b,n = list(map(int, input().split())) if n >= b-1: print((int(a*(b-1)/b)-a*int((b-1)/b))) else: print((int(a*n/b)-a*int(n/b)))
p02696
import math A,B,N=list(map(int,input().split())) maxi = min(A,N) ans = 0 for i in range(1,maxi+1): ans = max(ans,math.floor((A*i)/B)-A*math.floor(i/B)) if A<N: for i in range(A,B+1): ans = max(ans,math.floor((A*i)/B)-A*math.floor(i/B)) print(ans)
import math A,B,N=list(map(int,input().split())) maxi=min(B-1,N) print((math.floor((A*maxi)/B)-A*math.floor(maxi/B)))
p02696
import math s = list(map(int,input().split())) n=s[0] m=s[1] q=s[2] x=0 for i in range(1,q+1): re=math.floor(n*i/m)-math.floor(i/m)*n if x<re: x=re print(x)
import math s = list(map(int,input().split())) a = s[0] b = s[1] n = s[2] x = 0 if b-1 <= n: x = b-1 ans = math.floor(a*x/b)-n*math.floor(x/b) else: x = n ans = math.floor(a*x/b)-n*math.floor(x/b) print(ans)
p02696
import sys a,b,n = list(map(int,input().split())) d = 0 i = 0 for i in range(1,n+1): c = int(a*i/b)-a*int(i/b) if c >= d: d = c else: i += 1 if i > 1: print((int(a*(i-2)/b)-a*int((i-2)/b))) sys.exit() print(d)
a,b,n = list(map(int,input().split())) if n>= b-1: print((int(a*(b-1)/b)-a*int((b-1)/b))) else: print((int(a*n/b)-a*int(n/b)))
p02696
import math A, B, N = list(map(int, input().split())) l = [] if N < B: for x in range(N+1): l.append(math.floor(A*x/B) - A*math.floor(x/B)) else: for x in range(B): l.append(math.floor(A*x/B) - A*math.floor(x/B)) print((max(l))) # print(l)
import math A, B, N = list(map(int, input().split())) x = min(B-1, N) print((math.floor(A*x/B) - A*math.floor(x/B)))
p02696
a,b,n = [int(x) for x in input().split()] ans = 0 for x in range(1,n+1): if ans > ((a*x//b)-(x//b)*a): break else: ans = max(ans, (a*x//b)-(x//b)*a) print(ans)
a,b,n = [int(x) for x in input().split()] x = min(n,b-1) print(((a*x//b)-(x//b)*a))
p02696
A, B, N = [int(i) for i in input().split()] ans = 0 if N < B: ans = int(( A * (N % B) - (A * N) % B) / B) else: for x in range(B-1, N+1, B): tmp = int(( A * (x % B) - (A * x) % B) / B) if tmp >= ans: ans = tmp print(ans)
A, B, N = [int(i) for i in input().split()] ans = 0 if N < B: ans = int(( A * (N % B) - (A * N) % B) / B) else: tmp_ = int(( A * (N % B) - (A * N) % B) / B) x = (N - N % B - 1) tmp = int(( A * (x % B) - (A * x) % B) / B) ans = max(tmp, tmp_) print(ans)
p02696
a,b,N = list(map(int,input().split())) list =[] for x in range(N+1): list.append(int(a*x/b)-a*int(x/b)) print((max(list)))
a,b,N = list(map(int,input().split())) x =b-1 if x<N: print((int(a*x/b)-a*int(x/b))) else: x=N print((int(a*x/b)-a*int(x/b)))
p02696
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)
import math abn = list(map(int,input().split())) x = min(abn[1] - 1, abn[2]) m = math.floor(abn[0] * x / abn[1]) - abn[0] * math.floor(x / abn[1]) print(m)
p02696
from math import floor a, b, n = list(map(int, input().split())) max_x = 0 x = 0 a_b = a / b while n > 0: x = floor(a_b * (n % b)) max_x = x if x > max_x else max_x n -= 1 print(max_x)
from math import floor a, b, n = list(map(int, input().split())) x = min(b - 1, n) print((floor(a * x / b) - a * floor(x / b)))
p02696
import math A,B,N= list(map(int,input().split())) list=[] for i in range(N+1): list.append(math.floor((A*i)/B)-A*(math.floor(i/B))) print((max(list)))
import math A,B,N= list(map(int,input().split())) if B<=N: lista=(math.floor((A*(B-1))/B)-A*(math.floor((B-1)/B))) print(lista) else: list=(math.floor((A*N)/B)-A*(math.floor(N/B))) print(list)
p02696
import math bl=input().split() A=int(bl[0]) B=int(bl[1]) C=int(bl[2]) m=0 for x in range(C+1): y=math.floor(A*x/B)-A*math.floor(x/B) if y>m: m=y print(m)
import math bl=input().split() A=int(bl[0]) B=int(bl[1]) C=int(bl[2]) if C<B: m=math.floor(A*C/B)-A*math.floor(C/B) else: m=math.floor(A*(B-1)/B) print(m)
p02696
a, b, n = list(map(int, input().split())) ans = 0 if n < b-1: ans = ((a*n)//b - a*(n//b)) else: for i in range(b-1, n+1, b): ans = max(ans, (a*i)//b - a*(i//b)) print(ans)
a, b, n = list(map(int, input().split())) c = int(a*n/b) - a*int(n/b) if n < b: print(c) else: c = int(a*(b-1)/b) - a*int((b-1)/b) print(c)
p02696
a,b,n=list(map(int,input().split())) x_kouho=[] count=1 while count<=n//b: x_kouho.append(b*count-1) count+=1 if not x_kouho: x_kouho.append(n) res=0 for i in range(0,len(x_kouho)): keep=x_kouho[i] kept=(a*keep)//b-a*(keep//b) if kept>res: res=kept print(res)
a,b,n=list(map(int,input().split())) x_kouho=[] count=1 if b==1: res=0 else: while count<=n//b: x_kouho.append(b*count-1) count+=1 if not x_kouho: x_kouho.append(n) res=0 for i in range(0,len(x_kouho)): keep=x_kouho[i] kept=(a*keep)//b-a*(keep//b) if kept>res: r...
p02696
a, b, n = list(map(int, input().split())) if b < n: n = b ans_lst = [] for x in range(1, n+1): y = x / b ans = int(a*y) - a*int(y) ans_lst.append(ans) print((max(ans_lst)))
a, b, n = list(map(int, input().split())) y = n//b if y == 0: x = n else: x = b - 1 print((int(a*x/b) - a*int(x/b)))
p02696
a, b, n = list(map(int, input().split())) c = [0 for i in range(n+1)] x = 0 while x <= b and x <= n: c[x] = (a*x)//b - a*(x//b) x += 1 print((max(c)))
a, b, n = list(map(int, input().split())) x = min(b-1,n) print(((a*x)//b - a*(x//b)))
p02696
a, b, n = list(map(int, input().split())) ans = 0 for x in range(1,n+1): B = x/b f = B - int(B) if ans <= f: ans = f print((int(ans * a)))
a, b, n = list(map(int, input().split())) M = min(b-1,n) print((int((M/b-M//b) * a)))
p02696
a, b, n = list(map(int, input().split())) def f(x): return ((a * x) // b) - (a * (x // b)) if n < b - 1: max = f(n) else: x = b - 1 max = f(x) while x <= n: if max < f(x): max = f(x) x += b print(max)
a, b, n = list(map(int, input().split())) def f(x): return ((a * x) // b) - (a * (x // b)) if n < b - 1: max = f(n) elif b == 1: max = 0 else: x = b - 1 max = f(x) while x <= n: if max < f(x): max = f(x) x += b print(max)
p02696
a, b, n = list(map(int, input().split())) Max = 0 e = 1/b for i in range(n): i += 1 Max = max(Max, int(a*i*e)-a*int(i*e)) if Max != int(a*i*e)-a*int(i*e): print(Max) break else: print(Max)
a, b, n = list(map(int, input().split())) x = min(b-1, n) print((int(a*(x)/b)-a*int(x/b)))
p02696
a,b,n = list(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)
a,b,n = list(map(int,input().split())) c = min(b-1,n) print(((a*c)//b - a*(c//b)))
p02696
A, B, N = list(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)
A, B, N = list(map(int, input().split())) def f(x): return (A*x)//B - A*(x//B) if B > N: print((f(N))) elif B == N: print((f(N-1))) else: print((f(B-1)))
p02696
import math a,b,n=list(map(int, input().split())) x = 1 num = math.floor(n/b) if num == 0: x = n print((math.floor(a*x/b)-a*math.floor(x/b))) exit() else: ans = 0 for i in range(1,num+1): x = b*i-1 ans = max(ans,math.floor(a*x/b)-a*math.floor(x/b)) print(a...
import math a,b,n=list(map(int, input().split())) x = 1 num = math.floor(n/b) if num == 0: x = n print((math.floor(a*x/b)-a*math.floor(x/b))) exit() if num >= 100000: print((b-1)) exit() else: ans = 0 for i in range(1,num+1): x = b*i-1 ans = max(...
p02696
import math a, b, n = list(map(int, input().split())) m = 0 t = min(b, n) for i in range(b//a, t+1): if m < math.floor((a*i)/b) - a*math.floor(i/b): m = math.floor((a*i)/b) - a*math.floor(i/b) print(m)
import math a, b, n = list(map(int, input().split())) if n < b: print((math.floor((a*n)/b) - a*math.floor(n/b))) else: print((math.floor((a*(b-1))/b) - a*math.floor((b-1)/b)))
p02696
from math import * A,B,N=[int(i) for i in input().split()] f = lambda k:floor(A*k/B) k=0 mx=f(k) while k<=B-1 and k<=N: if f(k)>mx: mx=f(k) k+=1 print(mx)
from math import * A,B,N=[int(i) for i in input().split()] f = lambda k:floor(A*k/B) if B-1 < N: print((f(B-1))) else: print((f(N)))
p02696
A, B, N = list(map(int, input().split())) ans_dict = {} for x in range(N + 1): if (A * x) // B >= (A * (x // B)): ans_dict.setdefault((((A * x) // B) - (A * (x // B))), x) else: break print((max(ans_dict)))
A, B, N = list(map(int, input().split())) if N >= B: x = B - 1 ans = ((A * x) // B) - (A * (x // B)) else: x = N ans = ((A * x) // B) - (A * (x // B)) print(ans)
p02696
a, b, n = list(map(int, input().split())) max = num = int(a*n/b) - a * int(n/b) for x in range(0, n+1, b): num = int(a*(x-1)/b) - a * int((x-1)/b) if num > max: max = num print(max)
a, b, n = list(map(int, input().split())) if n<b: print((((a*n)//b) - a * (n//b))) else: print((((a*(b-1))//b) - a * ((b-1)//b)))
p02696
import math A, B, N = list(map(int, input().split())) x = N // 2 def floor(t): return math.floor(t) li = [] if B > N: for i in range(1, N + 1): li.append(floor((A*i) / B) - A * floor(i/B)) else: for i in range(1, B + 1): li.append(floor((A*i) / B) - A * floor(i/B)) print((max(li...
import math A, B, N = list(map(int, input().split())) x = N // 2 def floor(t): return math.floor(t) li = [] if B < N: print((floor((A*(B - 1)) / B) - A * floor((B - 1)/B))) elif B == N: print((floor((A*(N - 1)) / B) - A * floor((N - 1)/B))) else: print((floor((A*(N)) / B) - A * floor((N)/B)))...
p02696
a, b, n = list(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) i...
a, b, n = list(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) ...
p02696
#!/usr/bin/env python3 # vim: set fileencoding=utf-8 # pylint: disable=unused-import, invalid-name, missing-docstring, bad-continuation """Module docstring """ import functools import heapq import itertools import logging import math import random import string import sys from argparse import Argum...
#!/usr/bin/env python3 # vim: set fileencoding=utf-8 # pylint: disable=unused-import, invalid-name, missing-docstring, bad-continuation """Module docstring """ import functools import heapq import itertools import logging import math import random import string import sys from argparse import Argum...
p02696
import sys input = sys.stdin.readline A, B, N = list(map(int, input().split())) ans = 0 if N >= B-1: for i in range(B-1,N,B): ans = max(ans, ((A*i)//B) - A * (i//B)) ans = max(ans, ((A*N)//B) - A * (N//B)) print(ans)
import sys input = sys.stdin.readline A, B, N = list(map(int, input().split())) ans = 0 if N >= B-1: ans = max(ans, ((A*(B-1))//B) - A * ((B-1)//B)) else: ans = max(ans, ((A*N)//B) - A * (N//B)) print(ans)
p02696
a, b, n= [int(i) for i in input().split()] ans = 0 for i in range(min(n, b-1), 0, -1): ans = max(ans, int((a*i)/b)) if int((a*i)/b) < ans: break print(ans)
a, b, n= [int(i) for i in input().split()] if int(n/b) == 0: print((int((a*n)/b))) else: print((int((a*(b-1))/b)))
p02696
l=list(map(int,input().split())) a=l[0] b=l[1] n=l[2] x=0 for i in range(1,n+1): y=(((a*i)/b)//1)-(a*((i/b)//1)) if(y>x): x=y print((int(x)))
l=list(map(int,input().split())) a=l[0] b=l[1] n=l[2] if b-1<=n: i=b-1 else: i=n y=(((a*i)/b)//1)-(a*((i/b)//1)) print((int(y)))
p02696
import math a, b , n = list(map(int, input().split())) max = -1 x = 0 while(x < n): x += 1 new = math.floor(a*x/b) - a * math.floor(x/b) #print(math.floor(a*x/b), " - ", a * math.floor(x/b)) #print(new) if max < new: max = new print(max)
import math a, b, n = list(map(int, input().split())) x = n if b <= n: x = b-1 new = math.floor(a*x/b) - a * math.floor(x/b) print(new)
p02696
A,B,N=list(map(int,input().split())) C=A%B ans=0 for i in range(1,min(B,N+1)): b=i ans=max(ans, (A*b-C*b%B)//B) print(ans)
A,B,N=list(map(int,input().split())) C=A%B ans=0 b=min(B-1,N) ans=(A*b-C*b%B)//B print(ans)
p02696
A, B, N = list(map(int, input().split())) c = 0 t = -10 if N > 100000000: for i in range(100000000, N + 1): a = (i * A) // B - A * (i // B) c = max(c, a) if t > a or i > 1100000000: print(c) break t = a else: print(c) else: for i ...
A, B, N = list(map(int, input().split())) X = min(N, B - 1) print((A * X // B - A * (X // B)))
p02696
a,b,n = list(map(int,input().split())) ans = -10**10 for i in range(1,n+1): t = (a*i)//b f = i//b s = t-a*f if ans > s: break else: ans = s print(ans)
a,b,n = list(map(int,input().split())) ans = 0 if n >= b: ans = (a*(b-1))//b else: ans = (a*n)//b print(ans)
p02696
import sys stdin = sys.stdin sys.setrecursionlimit(10 ** 7) def LI(): return list(map(int, stdin.readline().split())) def LS(): return list(stdin.readline()) a,b,n = LI() import math ans = 0 for i in range(n+1): ans = max(ans, math.floor(a*i/b)-a*math.floor(i/b)) print(ans)
import sys stdin = sys.stdin sys.setrecursionlimit(10 ** 7) def LI(): return list(map(int, stdin.readline().split())) def LS(): return list(stdin.readline()) a,b,n = LI() m = min(b-1, n) print((int(a*m/b)-a*int(m/b)))
p02696
import sys sys.setrecursionlimit(10 ** 6) INF = float("inf") MOD = 10 ** 9 + 7 def input(): return sys.stdin.readline().strip() def main(): A, B, N = list(map(int, input().split())) def func(x): res = (A * x) // B - A * (x // B) return res M = 0 for i in r...
import sys sys.setrecursionlimit(10 ** 6) INF = float("inf") MOD = 10 ** 9 + 7 def input(): return sys.stdin.readline().strip() def main(): A, B, N = list(map(int, input().split())) def func(x): res = (A * x) // B - A * (x // B) return res print((func(min(N, B ...
p02696
a, b, n = list(map(int, input().split())) print((max([(a*i)//b - a*(i//b) for i in range(n + 1)])))
a, b, n = list(map(int, input().split())) if n < b: k = n else: k = b - 1 print(((a*k)//b - a*(k//b)))
p02696
from math import floor A, B, N = list(map(int, input().split())) def f(x): return floor(A * x / B) - A * floor(x / B) result = 0 for x in range(min(A + 1, N + 1)): result = max(result, f(x)) if B > A: for i in range(10 ** 20): x = (i * B + A - 1) // A if x > N: ...
from math import floor A, B, N = list(map(int, input().split())) x = min(B - 1, N) print((floor(A * x / B) - A * floor(x / B)))
p02696
import sys import itertools import collections # X = int(input()) A, B, N = list(map(int, input().split())) if B-1 < N: max_score = 0 for x in range(B-1, N+1, B): score = int(A*x/B) - A * int(x/B) if max_score < score: max_score = score print(score) else: print((int(A*N/B)))
import sys import itertools import collections # X = int(input()) A, B, N = list(map(int, input().split())) if B-1 < N: print((int(A*(B-1)/B))) else: print((int(A*N/B)))
p02696
import math def siki(A, B, X): return math.floor((A*X)/B) - A*math.floor(X/B) A,B,N = list(map(int,input().split())) x = N max_value = 0 if B > A * N: print((0)) else: if N < B: k = N else: k = B for i in range(1, k+1): if max_value < siki(A,B,i): max_value = siki(A,B,i) print(max...
import math def f(A, B, X): return math.floor((A*X)/B) - A*math.floor(X/B) A,B,N = list(map(int,input().split())) if N < B: print((f(A,B,N))) else: print((f(A,B,B-1)))
p02696
import math import sys input = sys.stdin.readline A, B, N = list(map(int, input().split())) ans = 0 for i in range(N + 1): t = math.floor(A * i / B) - A * math.floor(i / B) ans = max(ans, t) print(ans)
import math import sys input = sys.stdin.readline A, B, N = list(map(int, input().split())) x = min(B-1, N) print((math.floor(A*x/B) - A*math.floor(x/B)))
p02696
import math A, B, N = list(map(int, input().split())) ans = 0 for x in range(1, N+1): term1 = math.floor(A*x/B) term2 = A * math.floor(x/B) temp = term1 - term2 # print("x: {}, temp: {}, term1: {}, term2: {}".format(x, temp, term1, term2)) ans = max(ans, temp) print(ans)
import math DEBUG = False A, B, N = list(map(int, input().split())) if DEBUG: ans = 0 for x in range(1, N+1): term1 = math.floor(A*x/B) term2 = A * math.floor(x/B) temp = term1 - term2 print(("x: {}, temp: {}, term1: {}, term2: {}".format(x, temp, term1, term2))) ...
p02696
def main(): a, b, n = list(map(int, input().split())) ans = -10 ** 10 if b - 1 <= n: x = b - 1 ans = (a * x) // b - a * (x // b) else: for x in range(1, n + 1): ans = max(ans, (a * x) // b - a * (x // b)) print(ans) if __name__ == "__main__": ...
def f(a, b, x): return (a * x) // b - a * (x // b) def main(): a, b, n = list(map(int, input().split())) if n < b - 1: x = n else: x = b - 1 print((f(a, b, x))) if __name__ == "__main__": main()
p02696
A,B,N = list(map(int,input().split())) max = 0 for i in range(1,N+1): m = int(A*i/B)-A*int(i/B) if m>max: # print('i:', i) # print('m:', m) max = m # print(max) if N<B: m=N else: m=B-1 l = int(A*m/B)-A*int(m/B) print(l)
A,B,N = list(map(int,input().split())) if N<B: m=N else: m=B-1 l = int(A*m/B)-A*int(m/B) print(l)
p02696
import sys input = sys.stdin.readline a, b, n = list(map(int, input().replace("\n","").split())) ans = 0 #bがnよりも大きい時 if b > n: ans = int(a*n/b) print(ans) exit() #b==nのときは、終了間際の2個だけ比較する elif b == n: for i in range(n-1,n+1): tmpans = int(a*i/b) - (a*int(i/b)) if tmpan...
import sys input = sys.stdin.readline a, b, n = list(map(int, input().replace("\n","").split())) ans = 0 #bがnよりも大きい時 if b > n: ans = int(a*n/b) print(ans) exit() #b==nのときは、終了間際の2個だけ比較する elif b == n: for i in range(n-1,n+1): tmpans = int(a*i/b) - (a*int(i/b)) if tmpan...
p02696
import sys import itertools sys.setrecursionlimit(1000000000) from heapq import heapify,heappop,heappush,heappushpop import math import collections a,b,n = list(map(int,input().split())) ans = 0 for i in range(1,min(b+1,n+1)): d = math.floor((a*i)/b) e = a*math.floor(i/b) if e>0: bre...
import sys import itertools sys.setrecursionlimit(1000000000) from heapq import heapify,heappop,heappush,heappushpop import math import collections a,b,n = list(map(int,input().split())) ans = 0 if n < b-1: ans = math.floor((a*n)/b) else: ans = math.floor((a*(b-1))/b) print(ans)
p02696
import sys import itertools import math A,B,N = list(map(int, input().split())) a = 0 for i in range(1,N+1): a = max(a, math.floor(A*i/B) - A * math.floor(i/B)) print(a)
import sys import itertools import math A,B,N = list(map(int, input().split())) a = 0 i = min(B-1,N) print((math.floor(A*i/B) - A * math.floor(i/B)))
p02696
import math a, b, n = list(map(int, input().split())) ans = math.floor(a*n/b) - a*math.floor(n/b) x = b-1 while x <= n: ans = max(ans, math.floor(a*x/b) - a*math.floor(x/b)) x += b print(ans)
import math a, b, n = list(map(int, input().split())) x = min(b-1, n) ans = math.floor(a*x/b) - a*math.floor(x/b) print(ans)
p02696
a, b, n = list(map(int, input().split())) p = 10**9+7 ans = 0 for x in range(n+1): c = (int((a*x)%p/b))%p d = (int(x/b))%p e = (c - a*d)%p ans = max(ans, e) print(ans)
a, b, n = list(map(int, input().split())) c = min(b-1, n) print((int(a*c/b)))
p02696
import math a,b,n=list(map(int,input().split())) ans=0 for i in range(n): c=a*(i+1)//b-a*((i+1)//b) ans=max(c,ans) print(ans)
a,b,n=list(map(int,input().split())) print((a*min(n,b-1)//b-a*(min(b-1,n)//b)))
p02696
# coding: utf-8 # Your code here! import math line = list(map(int,input().split())) A,B,N =line[0],line[1],line[2] ans = (N+1)//B if ans ==0: print((math.floor(A*N/B)-A*math.floor(N/B))) else: start = (math.floor(A*N/B)-A*math.floor(N/B)) for i in range(1,ans+1): x= i*B-1 start...
# coding: utf-8 # Your code here! def main(): import sys line = sys.stdin.readline A,B,N = list(map(int,input().split())) if B>N: ans = A*N//B else: ans = A*(B-1)//B print(ans) if __name__== "__main__": main()
p02696
import math A,B,N=list(map(int,input().split())) range_list=list(range(N+1)) max_value=0 for i in range(N+1): check_value=math.floor(A*i/B)-A*math.floor(i/B) if(max_value<=check_value): max_value=check_value print(max_value)
A,B,N=list(map(int,input().split())) if B<=N: print((int(A*(B-1)/B)-A*int((B-1)/B))) else: print((int(A*(N)/B)-A*int(N/B)))
p02696
from sys import stdin, setrecursionlimit def main(): input = stdin.buffer.readline a, b, n = list(map(int, input().split())) ans = 0 for x in range(min(b, n + 1)): ans = max(int(a * x / b) - a * int(x / b), ans) print(ans) if __name__ == "__main__": setrecursionlim...
from sys import stdin, setrecursionlimit def main(): input = stdin.buffer.readline a, b, n = list(map(int, input().split())) ans = 0 x = min(b - 1, n) ans = max(int(a * x / b) - a * int(x / b), ans) print(ans) if __name__ == "__main__": setrecursionlimit(10000) ma...
p02696
import math a,b,n = list(map(int,input().split())) x = 0 now = 0 result = 0 for i in range(n+1): if x > b: break x = i now = (((a * x)//b)) - (a * (x//b)) #now = math.ceil(((a * x)/b)) - (a * math.ceil(x/b)) #print("now=",now,"x=",x) #print(result,now) result...
a,b,n = list(map(int,input().split())) x = min(b-1,n) print((((a * x)//b)) )
p02696
a,b,n = list(map(int,input().split())) x = min(b-1,n) print((((a * x)//b)) )
a,b,n = list(map(int,input().split())) if b > n: x = n else: x = b - 1 print((((a * x)//b)) )
p02696
ABN = input().split() A = int(ABN[0]) B = int(ABN[1]) N = int(ABN[2]) answer = 0 temp = 0 for x in range(N+1): temp = (A*x)//B - A * (x//B) if answer < temp: answer = temp print(answer)
ABN = input().split() A = int(ABN[0]) B = int(ABN[1]) N = int(ABN[2]) answer = 0 temp = 0 if N >= B: answer = A*(B-1) // B - A * ((B-1)//B) else: answer = A*N //B - A * (N//B) print(answer)
p02696
import math A,B,N = list(map(int, input().split())) if(N < B): print((math.floor(A * N / B) - A * math.floor(N / B))) else: print((math.floor(A * (B-1) / B) - A * math.floor((B-1) / B)))
import math A,B,N = list(map(int, input().split())) x = min(N, B-1) print((math.floor(A * x / B) - A * math.floor(x / B)))
p02696
import math def formula(x): return math.floor(A*x/B)-(A*math.floor(x/B)) A,B,n=[int(x) for x in input().split()] maxi=formula(1) for i in range(2,n+1): maxi=max(formula(i),maxi) print(maxi)
import math def formula(x): return math.floor(A*x/B)-(A*math.floor(x/B)) A,B,n=[int(x) for x in input().split()] if(n<=B-1): x=n else: x=B-1 maxi = formula(x) print(maxi)
p02696
def main(): ans = 0 a,b,n = list(map(int, input().split())) n = min(b-1, n) ans = (a*n)//b - a*(n//b) print(ans) if __name__ == '__main__': main()
a,b,n = list(map(int, input().split())) x = min(n, b-1) ans = a*x//b - a*(x//b) print(ans)
p02696
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) if N >= B: n = int(N/B) for i in range(n): x = i*B temp = ans1 = int((A*(x-1...
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() x=min(B-1,N) ans = int((A*x)/B)-A*int(x/B) print(ans) # if N >= B:
p02696
from sys import stdin A, B, N = [int(x) for x in stdin.readline().rstrip().split()] ans1 = (A*N)//B-A*(N//B) if B-1<=N: ans2 = (A*(B-1))//B else: ans2=0 print((max(ans1,ans2)))
from sys import stdin A, B, N = [int(x) for x in stdin.readline().rstrip().split()] ans1 = ((A*N)//B)-A*int(N/B) if B-1<=N: ans2 = (A*(B-1))//B else: ans2=0 print((max(ans1,ans2)))
p02696
A, B ,N = list(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]))
A, B ,N = list(map(int, input().split())) #x = [i+1 for i in range(N)] gokei = [int((A*(a+1))/B) - A*int((a+1)/B) for a in range(N)] """ 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]))
p02696
A, B, N = list(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)
A, B, N = list(map(int,input().split())) if N <= B-1: max = int(A*N/B) - A*int(N/B) else: max = int(A*(B-1)/B) - A*int((B-1)/B) print(max)
p02696
import math a,b,n=list(map(int,input().split())) for i in reversed(list(range(b))): if i<=n: print((math.floor(a*i/b))) break
import math a,b,n=list(map(int,input().split())) # for i in reversed(range(b)): # if i<=n: # print(math.floor(a*i/b)) # break if b <= n: print((math.floor(a*(b-1)/b))) else: print((math.floor(a*n/b)))
p02696
a,b,n = list(map(int, input().split())) fnc = lambda x: int(a*x/b) - a*int(x/b) prev = 0 for i in range(n+1): now = fnc(i) if prev > now: print(prev) break elif i == n: print(now) break prev = now
a,b,n = list(map(int, input().split())) if n < b: print((int(a/b * n))) else: print((int(a/b * (b-1))))
p02696
# -*- 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) # 求...
# -*- coding: utf-8 -*- # モジュールのインポート import math # 標準入力の取得 A, B, N = list(map(int, input().split())) def f(x: int) -> int: return math.floor(A*x/B) - A*math.floor(x/B) # 求解処理 result = f(min(B-1, N)) # 結果出力 print(result)
p02696
A, B, N= list(map(int, input().split())) max=0 for i in range(N): x=i+1 a=(A*x)//B b=x//B f=a-A*b if max<f: max=f print(max)
A,B,N=list(map(int,input().split())) if N+1>=B: T=int(A*(B-1)/B) print(T) else: T=int(A*N/B) print(T)
p02696
import math A, B, N = list(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))])))
import math A, B, N = list(map(int, input().split())) def f(A, B, x): return math.floor((A * x) / B) - A * math.floor(x / B) x = N if N < B else B - 1 print((f(A, B, x)))
p02696
import math ans=0 a,b,n=list(map(int,input().split())) for i in range(n+1): keep=math.floor(a*i/b)-a*math.floor(i/b) if ans<keep: ans=keep print(ans)
import math ans=-100000000 a,b,n=list(map(int,input().split())) i=min(n,b-1) keep=math.floor(a*i/b)-a*math.floor(i/b) print(keep)
p02696
a, b, n = list(map(int, input().split())) ans_list = [] for x in range(n+1): new_ans = int(a*x/b) - int(x/b) * a ans_list.append(new_ans) print((max(ans_list)))
a, b, n = list(map(int, input().split())) ans = min(b-1, n) print((int(a*ans/b)-a*int(ans/b)))
p02696
#!/usr/bin/env python3 from collections import defaultdict,deque from heapq import heappush, heappop from bisect import bisect_left, bisect_right import sys, random, itertools, math sys.setrecursionlimit(10**5) input = sys.stdin.readline sqrt = math.sqrt def LI(): return list(map(int, input().split())) def LF(...
a,b,n=list(map(int,input().split())) def f(x): return a*x//b-a*(x//b) if n<b: ans =f(n) else: t = n u = b - 1 ans=max(f(t),f(u)) print(ans)
p02696
a, b, n = list(map(int, input().split())) if a == 1 or b == 1: print((0)) else: ans = 0 prev = 0 for x in range(n+1): tmp = (a*x)//b - a*(x//b) if prev > 0 and tmp == 0: ans = prev break prev = tmp else: ans = prev print(ans)
a, b, n = list(map(int, input().split())) print(((a*min(b-1,n))//b))
p02696
a, b, n = list(map(int, input().split())) ans = [int(a * x / b) - a * int(x / b) for x in range(n+1)] print((max(ans)))
A, B, N = list(map(int, input().split())) x = min(B-1, N) print((A*x // B - A * (x//B)))
p02696
import math def main(): A,B,N = list(map(int, input().split())) max1 = 0 k1 = math.ceil(B/A) k2 = B+1 if B<N else N+1 for x in range(k1,k2): tmp = int(A*x/B) - A*int(x/B) max1 = max(max1,tmp) print(max1) main()
def main(): A,B,N = list(map(int, input().split())) x = min(B-1,N) max1 = int(A*x/B) - A*int(x/B) print(max1) main()
p02696