input stringlengths 20 127k | target stringlengths 20 119k | problem_id stringlengths 6 6 |
|---|---|---|
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 ... | 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 ... | p02696 |
a,b,n = list(map(int,input().split()))
c =0
for i in range(n+1):
p =i % b
P = a*p//b
if P > c:
c = P
print(c) | a,b,n = list(map(int,input().split()))
c = 0
if n >=b:
i = b-1
else:
i =n
ans = int(a*i/b)-a*int(i/b)
print(ans)
| p02696 |
x, y, z = list(map(int, input().split()))
if y - 1 >= z:
print(((x * z) // y - x * (z // y)))
else:
w = (z // y) * y - 1
print((max((x * w) // y - x * (w // y), (x * z) // y - x * (z // y))))
| a,b,n=list(map(int,input().split()))
f=lambda x:(a*x)//b-a*(x//b)
print((f(min(b-1,n)))) | p02696 |
def main():
import math
a, b, n = list(map(int, input().split()))
ans = 0
if n > 10 ** 11:
for x in range(n, 10 ** 9, -1):
fx = math.floor(a/b * x) - math.floor(x / b) * a
#print(fx)
if ans < fx:
ans = fx
if ans > fx + 10 ... |
def main():
import math
a, b, n = list(map(int, input().split()))
if n >= b:
ans = math.floor(a * (b-1)/b)
else:
ans = math.floor(a * n / b)
print(ans)
if __name__ == "__main__":
main() | p02696 |
import math
def f(x,y,z):
# x,y,z = A,x,B
return math.floor(x*y/z) - x*math.floor(y/z)
a,b,n = list(map(int,input().split()))
if n<b:
print((math.floor(a*n/b)))
else:
k = n//b
ret = f(a, b-1, b)
for kk in range(1, k+1):
ret = max(ret, f(a,b*kk-1,b))
print(ret) | import math
def f(x,y,z):
# x,y,z = A,x,B
return math.floor(x*y/z) - x*math.floor(y/z)
a,b,n = list(map(int,input().split()))
if n<b:
print((math.floor(a*n/b)))
else:
print((f(a, b-1, b))) | p02696 |
from math import floor
A,B,N=list(map(int,input().split()))
x=N
result=[]
maxr=0
for x in reversed(list(range(1,N+1))):
xb=x/B
r=0 if xb < 1 else A*floor(xb)
l=floor(A*xb)
ans=l-r
# print(xb,l,r,ans)
result.append(ans)
if len(result) == 1:
maxr = ans
if len(resul... | 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 |
a,b,n = list(map(int, input().split()))
max = 0
for x in range(0,min(b,n+1)):
M = int(a*x/b) - a*int(x/b)
if max < M:
max = M
print(max) | a,b,n = list(map(int, input().split()))
m = min(n,b-1)
print((int(a*m/b)-a*int(m/b))) | p02696 |
import math
a,b,n=list(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) | import math
a,b,n=list(map(int,input().split()))
c=min(b-1,n)
print((math.floor(a*c/b)-a*math.floor(c/b))) | p02696 |
import sys
import math
if __name__ == '__main__':
a, b, n = list([int(x) for x in 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... | import sys
import math
if __name__ == '__main__':
a, b, n = list([int(x) for x in sys.stdin.readline().split(' ')])
old = 0
if 0 <= b-1 and b-1 <= n:
x = b - 1
print((math.floor(a*x/b)-a*math.floor(x/b)))
else:
x = n
print((math.floor(a*x/b)-a*math.floor(x/b))... | p02696 |
import math as m
A, B, N = list(map(int, input().split()))
if N >= B:
print((m.floor(A * -1 / B) - A * m.floor(-1 / B)))
else:
list = []
flag = 0
list += [m.floor(A * 0 / B) - A * m.floor(0 / B)]
for x in range(1, N + 1):
list += [m.floor(A * x / B) - A * m.floor(x / B)]
if list... | import math as m
A, B, N = list(map(int, input().split()))
if N >= B: print((m.floor(A * -1 / B) - A * m.floor(-1 / B)))
else: print((m.floor(A * N / B) - A * m.floor(N / B))) | p02696 |
A, B, N = list(map(int, input().split()))
ans = 0
for x in range(int(N**0.5), N+1):
ans = max(ans, (A*x)//B-A*(x//B))
print(ans) | A, B, N = list(map(int, input().split()))
ans = 0
x = min(B-1, N)
print(((A*x)//B-A*(x//B)))
| p02696 |
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 = list(map(int, readline().split()))
if b > n:
print((floor(a * n / b) - a * floor(n / b)))
else:
print((floor(a * (b - ... | 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 = list(map(int, readline().split()))
print((floor(a * min(b - 1, n) / b) - a * floor(min(b - 1, n) / b)))
| p02696 |
A,B,N=list(map(int,input().split()))
import math
def f(x):
return math.floor(A*x/B) - A*math.floor(x/B)
ans = []
for i in range(1, N//B+1):
ans.append(f(B*i-1))
ans.append(f(N))
ans.append(f(1))
#print(f(N))
print((max(ans))) |
A,B,N=list(map(int,input().split()))
import math
def f(x):
return math.floor(A*x/B) - A*math.floor(x/B)
print((f(min(B-1,N)))) | p02696 |
#import matplotlib.pyplot as plt
def main():
a,b,n = list(map(int,input().split()))
mx = 0
for x in range(min(b,n)//2,min(b+1,n+1)):
left = int(a*x/b)
right = a * int(x/b)
#print("x=",x,"floor(Ax/B)=",int(a*x//b),"A*floor(x/B)=",a * int(x // b),"answer=",left-right)
... | #import matplotlib.pyplot as plt
def main():
a,b,n = list(map(int,input().split()))
x = min(b-1,n)
print((int(a*x/b) - a * int(x/b)))
#plt.plot(list(range(len(right))),right,label="test")
if __name__ == '__main__':
main()
| p02696 |
import math
import sys
sys.setrecursionlimit(2000000)
# import itertools
# import statistics
# import numpy as np
# x = int(input())
a, b, n = list(map(int, input().split()))
ans = a*n//b - a*(n//b)
count = 0
same = 0
# print(ans)
for i in range(n, int(pow(n, 0.75))-1, -1):
if ans < a*i//b - a*(i//b)... | a, b, n = list(map(int, input().split()))
x = min(b-1, n)
ans = a*x//b - a*(x//b)
print(ans)
| p02696 |
import sys
sys.setrecursionlimit(10**7)
a,b,n = list(map(int, input().split()))
def num(x):
return (a*x)//b - a*(x//b)
ma = num(1)
for i in range(2, n+1):
if num(i) > ma:
ma = num(i)
print(ma) | 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()))
n = b if n > b else n
ans = 0
for x in range(n, 0, -1):
if x > b:
continue
ans = max(a * x // b - a * (x // b), ans)
print(ans) | a, b, n = list(map(int, input().split()))
x = min(n, b-1)
ans = a * x // b - a * (x // b)
print(ans)
| p02696 |
a,b,n=list(map(int,input().split()))
res=0
x=n
for x in range(min(b,n+1)):
res=max(res,int(a*x/b)-a*int(x/b))
print(res)
| a,b,n=list(map(int,input().split()))
x=min(b-1,n)
max_res=int(a*x/b)-a*int(x/b)
print(max_res) | p02696 |
data = input().split()
a = int(data[0])
b = int(data[1])
n = int(data[2])
max = 0
cnt = 1
for i in range(n+1):
x = cnt * b - 1
if x > n:
x = n
i = n
test = int(a*x/b) - a*int(x/b)
if max < test:
max = test
i = i + b
cnt = cnt + 1
print(max) | a,b,n = list(map(int, input().split()))
def func(x):
return int(a*x/b) - a*int(x/b)
if n < b-1:
print((func(n)))
else :
print((func(b-1))) | p02696 |
A, B, N = list(map(int, input().split()))
def floor(t):
return int(t)
Ans_0 = 0
for x in range(min(B+1, N+1)):
Ans = floor(A * x / B) - A * floor(x / B)
if Ans_0 < Ans:
Ans_0 = Ans
print(Ans_0) | A, B, N = list(map(int, input().split()))
def floor(t):
return int(t)
Ans = floor(A * min(N, B-1) / B)
print(Ans) | p02696 |
from math import floor
A, B, N = list(map(int, input().split()))
AdB = A/B
m = 0
for x in range(1, N + 1):
if x < B:
n = floor(x * AdB)
if n > m:
m = n
else:
n = floor(x * AdB) - A * floor(x / B)
if n > m:
m = n
print(m)
| from math import floor
A, B, N = list(map(int, input().split()))
print((floor((min(N + 1, B) - 1) * A / B)))
| p02696 |
import math
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
a, b, n = list(map(int, readline().split()))
t = 0
max_t = 0
for i in range(n, 1, -1):
t = math.floor(a*i/b) - a * math.floor(i/b)
if t > max_t:
max_t = t
pri... | import math
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
a, b, n = list(map(int, readline().split()))
ans = math.floor(a * min(n, b-1) / b)
print(ans)
| p02696 |
A, B, N = list(map(int, input().split()))
ans = 0
for i in range(N+1):
x = (A*i)//B - A*(i//B)
ans = max(ans, x)
print(ans) |
A, B, N = list(map(int, input().split()))
if N >= B:
print(((A*(B-1))//B))
else:
print(((A*N)//B - A*(N//B)))
| p02696 |
import math
A, B, N = list(map(int, input().split()))
ans = math.floor(A*min(N, B-1)/B) - A*math.floor(min(N, B-1)/B)
print(ans)
| A, B, N = list(map(int, input().split()))
ans = int(A*(min(N, B-1)/B))-A*int(min(N, B-1)/B)
print(ans)
| p02696 |
a,b,n=list(map(int,input().strip().split()))
t=0
for i in range(n+1):
if (b-1)<=n:
t=(a*(b-1)//b)
else:
t=(a*n)//b
# t=max(t,((a*i)//b)-(a*(i//b)))
print(t)
| a,b,n=list(map(int,input().strip().split()))
t=0
if (b-1)<=n:
t=(a*(b-1)//b)
else:
t=(a*n)//b
# t=max(t,((a*i)//b)-(a*(i//b)))
print(t)
| p02696 |
import math
A,B,N=list(map(int,input().split()))
x_max=0
for x in range(N+1):
x_max=max(math.floor(A*x/B)-A*math.floor(x/B),x_max)
print(x_max) | import math
A,B,N=list(map(int,input().split()))
def D_func(x):
return math.floor(A*x/B)-A*math.floor(x/B)
print((D_func(min(B-1,N)))) | p02696 |
A, B, N = list(map(int, input().split()))
tmp_pre = 0
for i in range(1, N+1):
if (i%B!=0):
continue
else:
tmp = (A*(i-1))//B - A*((i-1)//B)
if tmp > tmp_pre:
tmp_pre = tmp
if (B > N):
print(((A*N)//B - A*(N//B)))
else:
print((int(tmp_pre))) | A, B, N = list(map(int, input().split()))
if B==1:
print((0))
else:
tb = B - 1
tp_pre = 0
while(True):
tp = (A*tb)//B - A*(tb//B)
if tp > tp_pre:
tp_pre = tp
tb += B
if tb > N:
break
if (B > N):
print(((A*N)//B - A*(N//B)))
else:
print((int(tp_pre))) | p02696 |
import math
a, b, n = list(map(int, input().split()))
ans = 0
for x in range(n + 1):
new = math.floor((a * x) / b) - a * math.floor(x / b)
if new > ans:
ans = new
print(ans)
| import math
a, b, n = list(map(int, input().split()))
if b <= n:
if n != 1:
n = b - 1
ans1 = math.floor((a * n) / b)
ans2 = a * math.floor(n / b)
ans3 = ans1 - ans2
print(ans3)
| p02696 |
import math
A,B,N=list(map(int,input().split()))
a=min(B,N)
array=[]
for x in range(1,a+1):
array.append(math.floor(A*x/B)-A*math.floor(x/B))
print((max(array)))
| import math
A,B,N=list(map(int,input().split()))
a=min(B,N)
if a==B:
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,c = list(map(int,input().split()))
maxcnt = -99999
if c <= b-1:
for x in range(c+1):
cnt = (a*x)//b - a*(x//b)
if cnt > maxcnt:
maxcnt = cnt
else:
x = b-1
maxcnt = math.floor(a*x/b) - a* math.floor(x/b)
print(maxcnt) | import math
a,b,c = list(map(int,input().split()))
maxcnt = -99999
if c <= b-1:
x = c
cnt = (a*x)//b - a*(x//b)
if cnt > maxcnt:
maxcnt = cnt
else:
x = b-1
maxcnt = math.floor(a*x/b) - a* math.floor(x/b)
print(maxcnt) | p02696 |
a,b,n = list(map(int, input().split()))
ans = 0
for i in range(n):
tmp = (a*i+a)//b - (i+1)//b * a
ans = max(ans, tmp)
print(ans) | a,b,n = list(map(int, input().split()))
y = min(b-1, n)
ans = a*y//b - y//b * a
print(ans) | p02696 |
a,b,n = list(map(int,input().split()))
max1 = (a*2)//b - a*(2//b)
max2 = (a*(n//2))//b - a*((n//2)//b)
for i in range(2,n//2):
if (a*i)//b - a*(i//b) >= max1:
max1 = (a*i)//b - a*(i//b)
for i in range(n//2,n+1):
if (a*i)//b - a*(i//b) >= max2:
max2 = (a*i)//b - a*(i//b)
if max... | a,b,n = list(map(int,input().split()))
if n >= b-1:
x = b-1
else:
x = n
ans = (a*x)//b - a*(x//b)
print(ans) | p02696 |
from math import floor
A,B,N=list(map(int,input().split()))
ans = 0
for x in range(N+1):
a = floor(A*x/B)-A*floor(x/B)
if ans < a:
ans = a
if B<x:
break
print(ans) | from math import floor
A,B,N=list(map(int,input().split()))
x=min((B-1),N)
ans=floor(A*x/B)-A*floor(x/B)
print(ans) | p02696 |
a, b, n = list(map(int, input().split()))
max = 0
for i in range(1, n + 1):
tmp = ((a * i) // b) - (a * (i // b))
max = tmp if tmp > max else max
print(max) | 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()))
# S = input()
# X1_list = [int(input()) for i in range(N)]
# X2_list = [list(map(int,input().split())) for i in range(N)]
if N < B:
a = int(A * N / B)
b = A * int(N / B)
print((a - b))
exit(0)
ans = 0
before_ans = 0
for i in range(1, N + 1):
... | A, B, N = list(map(int, input().split()))
# S = input()
# X1_list = [int(input()) for i in range(N)]
# X2_list = [list(map(int,input().split())) for i in range(N)]
def solve(i):
a = int(A * i / B)
b = A * int(i / B)
return a - b
print((solve(min(N, B - 1)))) | p02696 |
A,B,N=list(map(int,input().split()))
M=0
if B<N:
C=B
else:
C=N
for i in range(C+1):
x=int(A*i/B)
y=int(i/B)
z=x-A*y
if M<z:
M=z
print(M) | A,B,N=list(map(int,input().split()))
if B==N:
C=B-1
elif B<N:
C=B-1
else:
C=N
x=int(A*C/B)
y=int(C/B)
z=x-A*y
print(z) | p02696 |
a, b, n = list(map(int, input().split()))
ans = 0
for x in range(1, n+1):
front = (a*x - (a*x)%b)//b
back = ((x - x%b))//b
ans = max(ans, front - back * a)
print(ans)
| a, b, n = list(map(int, input().split()))
if n < b - 1:
print((a*(n%b)//b))
else:
print((a*((b-1)%b)//b))
| p02696 |
import math
A, B, N = (int(x) for x in input().split())
h = []
a = 0
for i in range(0, N+1):
a = math.floor(A * i / B) - A * math.floor(i / B)
h.append(a)
print((max(h))) | import math
A, B, N = (int(x) for x in input().split())
ans = math.floor(A * min(B-1, N) / B)
print(ans) | p02696 |
import sys
input = sys.stdin.readline
input = sys.stdin.buffer.readline
def RD(): return sys.stdin.read()
def II(): return int(eval(input()))
def MI(): return list(map(int,input().split()))
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [inpu... | import sys
input = sys.stdin.readline
input = sys.stdin.buffer.readline
def RD(): return sys.stdin.read()
def II(): return int(eval(input()))
def MI(): return list(map(int,input().split()))
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [inpu... | p02696 |
a,b,n=(list(map(int,input().split())))
ans=0
for i in range(n+1):
c=int(a*i/b)-a*int(i/b)
if c>ans:
ans=c
print(ans) | A, B, N = list(map(int, input().split()))
def solve(i):
return A * i // B - A * (i // B)
print((solve(min(B-1, N)))) | p02696 |
import math
A, B, N = list(map(int,input().split()))
x = [i for i in range(1,N+1)]
res = [math.floor(A*x[i]/B) - (A*math.floor(x[i]/B)) for i in range(N)]
print((max(res))) | A, B, N = list(map(int,input().split()))
x = min(B-1,N)
res = int(A*x/B) - (A*int(x/B))
print(res) | p02696 |
from math import floor
a,b,n = list(map(int,input().split()))
ans = 0
if n <= b:
for i in range(n+1):
ans = max(ans,floor(a*i/b) - a*floor(i/b))
else:
for i in range(max(0,b-10),min(n,b+10)):
ans = max(ans,floor(a*i/b) - a*floor(i/b))
print(ans) | from math import floor
a,b,n = list(map(int,input().split()))
ans = 0
if n <= b:
for i in range(max(0,n-9),n+1):
ans = max(ans,floor(a*i/b) - a*floor(i/b))
else:
for i in range(max(0,b-10),min(n,b+10)):
ans = max(ans,floor(a*i/b) - a*floor(i/b))
print(ans) | p02696 |
import sys
import math
import fractions
from collections import deque
from collections import defaultdict
sys.setrecursionlimit(10**7)
A, B, N = list(map(int, input().split()))
m = -1
for x in range(1, N+1):
res = math.floor(A * x / B) - A * math.floor(x / B)
if res >= m:
m = res
e... | import sys
import math
import fractions
from collections import deque
from collections import defaultdict
sys.setrecursionlimit(10**7)
A, B, N = list(map(int, input().split()))
# m = -1
# for x in range(1, N+1):
# res = math.floor(A * x / B) - A * math.floor(x / B)
# print(res)
if B > N:
... | p02696 |
A, B, N = list(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) | A, B, N = list(map(int, input().split()))
#result = int(((N/B-int(N/B))*A))
ma = min(N,B-1)
result = int(((ma/B-int(ma/B))*A))
print(result) | p02696 |
import math
a, b, n = list(map(int, input().split()))
num = 0
max_num = 0
for i in range(1, n+1):
num = math.floor(a*i/b) - a * math.floor(i / b)
max_num = max(max_num, num)
print(max_num) | import math
a, b, n = list(map(int, input().split()))
if b > n:
ans = math.floor(a*n/b) - a*math.floor(n/b)
else:
num = b - 1
ans = math.floor(a*num/b) - a*math.floor(num/b)
print(ans) | p02696 |
a, b, n = list(map(int, input().split()))
ans = 0
for i in range(1, min(n, b)+1):
ans = max(ans, int(a*i/b)-a*int(i/b))
print(ans) | 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()))
ma = 0
if(n < b):
s = a * n / b
t = n / b
ss = s // 1
tt = (t // 1) * a
ma = ss - tt
else:
for i in range(b-1,n+1,b):
s = a * i / b
t = i / b
ss = s // 1
tt = (t // 1) * a
if(ma < ss - tt):
... | a,b,n = list(map(int, input().split()))
def ma(k):
s = a * k / b
t = k / b
ss = s // 1
tt = (t // 1) * a
return ss - tt
if(n < b):
print((str(int(ma(n)))))
else:
print((str(int(ma(b-1))))) | p02696 |
#!/usr/bin/env python3
A, B, N = list(map(int, input().split()))
num = 0
ans = 0
for x in range(1, N+1):
num = (A*x)//B - A*(x//B)
ans = max(ans, num)
print(ans) | #!/usr/bin/env python3
A, B, N = list(map(int, input().split()))
num = 0
ans = 0
if N >= B:
print(((A*(B-1))//B - A*((B-1)//B)))
else:
print(((A*N)//B - A*(N//B))) | p02696 |
a,b,n=list(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) | a,b,n=list(map(int,input().split()))
"""
m=-1
for i in range(b+1):
w=int(a*i/b)-a*int(i/b)
if m<w or m==-1:
m=w
print(m)
"""
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 |
A, B ,N = list(map(int,input().split()))
if B-1 <= N:
print((A*(B-1)//B))
else:
ans = 0
for x in range(1,N+1):
ans_candidate = (A*x)//B- A*(x//B)
if ans < ans_candidate:
ans = ans_candidate
print(ans)
| A, B ,N = list(map(int,input().split()))
if B-1 <= N:
print((A*(B-1)//B))
else:
print((A*N//B))
| p02696 |
a, b, n = list(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) | a, b, n = list(map(int, input().split()))
x = min(n, b - 1)
print((int(a * x / b) - a * int(x / b))) | p02696 |
# floor(Ax/B) - A floor(x/B) の最大値Mを求める
# xはN以下の非負整数
# floor(Ax / B) = M + A floor(x / B)
# x / B = k + r
# Ax / B = Ak + Ar
# floor(Ak + Ar) = M + A floor(k + r)
# Ak + floor(Ar) = M + Ak + A floor(r)
# floor(Ar) = M
# r = x / B - k
# M = floor(A * (x / B - k))
# = floor(A * x /B) - Ak
# = floor(A/B ... | # floor(Ax/B) - A floor(x/B) の最大値Mを求める
# xはN以下の非負整数
# floor(Ax / B) = M + A floor(x / B)
# x / B = k + r
# Ax / B = Ak + Ar
# floor(Ak + Ar) = M + A floor(k + r)
# Ak + floor(Ar) = M + Ak + A floor(r)
# floor(Ar) = M
# r = x / B - k
# M = floor(A * (x / B - k))
# = floor(A * x /B) - Ak
# = floor(A/B ... | p02696 |
from collections import deque
def main():
A,B,N=list(map(int,input().split()))
d=deque()
x=0
while(x<=N):
#tmp=((A*x)//B)-A*(x//B)
if (A*x<B):
tmp1=0
if (x<B):
tmp2=0
tmp1=((A*x)//B)
tmp2=A*(x//B)
tmp=tmp1-tmp2
... | from math import floor
def main():
A,B,N=list(map(int,input().split()))
ans1=min(N,B-1)
ans2=floor(A*ans1/B)-A*floor(ans1/B)
print(ans2)
if __name__=="__main__":
main()
| p02696 |
A, B, N = list(map(int, input().split()))
if N < B:
print(((A*N)//B))
exit()
qa, ra = divmod(A, B)
ans = 0
rx = 0
for x in range(N+1):
rx = max(rx, x%B)
if rx == B-1:
break
print((qa*rx + (ra*rx)//B))
| A, B, N = list(map(int, input().split()))
if N < B:
print(((A*N)//B))
else:
qa, ra = divmod(A, B)
rx = B-1
print((qa*rx + (ra*rx)//B))
| p02696 |
import math
A,B,N = list(map(int,input().split()))
ans = 0
for i in range(1,N+1):
score = 0
score = math.floor(A*i/B) -A* math.floor(i/B)
ans = max(ans,score)
print(ans) | A,B,N = list(map(int,input().split()))
x = min(N,B-1)
print(( int(A*x/B))) | p02696 |
a, b, n = list(map(int, input().split()))
ans = 0
for i in range(n, 0, -1):
value = (a*i//b) - a*(i//b)
ans = max(value, ans)
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()))
max_ = 0
for x in range(1,N+1):
C = (A*x)//B - A*(x//B)
if C > max_:
max_ = C
print(max_) | A,B,N = list(map(int,input().split()))
if B-1>N:
x = N
else :
x = B-1
print(( (A*x)//B - A*(x//B))) | p02696 |
a,b,n = list(map(int,input().split()))
max = 0
s = int(b/a)
f = n+1
if b < n:
f = b+1
for i in range(s,f):
buf = a*(i%b)-(a*i)%b
if buf > max:
max = buf
print((int(max/b))) | a,b,n = list(map(int,input().split()))
def f(x):
return int(a*x/b)-a*int(x/b)
w=min(n,b-1)
ma=f(w)
print(ma) | p02696 |
import math
import sys
a, b, n = list(map(int, input().split()))
step = math.ceil(1/10**3)
array = list(range(1, n+1, step))
ans = -sys.maxsize-1
for x in array:
val = int((a*x)/b) - a*int(x/b)
if val > ans:
ans = val
print(ans)
| a, b, n = list(map(int, input().split()))
x = min(b-1, n)
ans = int((a*x)/b) - a*int(x/b)
print(ans)
| p02696 |
a,b,n=list(map(int,input().split()))
pmax=0
for i in range(1,n+1):
p = i/b - i//b
if pmax < p:
pmax=p
print((int(pmax*a))) | a,b,n=list(map(int,input().split()))
if n>=b:
print((int((b-1)/b*a)))
else:
print((int(n/b*a))) | p02696 |
A, B, N = list(map(int, input().split()))
c = 0
i = 1
x = B * i - 1
while x <= N:
cc = (A * x) // B - A * (x // B)
c = max(c, cc)
i += 1
x = B * i - 1
if c == 0:
x = N
c = (A * x) // B - A * (x // B)
print(c) | A, B, N = list(map(int, input().split()))
if N >= B - 1:
x = B - 1
c = (A * x) // B - A * (x // B)
else:
x = N
c = (A * x) // B - A * (x // B)
print(c) | p02696 |
import math
a, b, n = list(map(int, input().split()))
ans = []
for i in range (n):
s = math.floor((a * (i + 1)) / b) - a * math.floor((i + 1) / b)
ans.append(s)
if max(ans) > s:
break
print((max(ans))) | import math
a, b, n = list(map(int, input().split()))
ans = []
def Calcf(i):
return math.floor((a * i) / b) - a * math.floor(i / b)
print((Calcf(min(b - 1, n)))) | p02696 |
A,B,N = list(map(int,input().split()))
ans = 0
if N >= B-1:
for i in range(B-1,N+1,B):
a =A*i//B
b = A*(i//B)
ans = max(ans,a-b)
else:
ans = A*N//B - A*(N//B)
print(ans) | A,B,N = list(map(int,input().split()))
if N >= B-1:
i = B-1
ans = A*i//B - A*(i//B)
else:
ans = A*N//B - A*(N//B)
print(ans) | p02696 |
a,b,n = list(map(int,input().split()))
x = list()
if n<=b:
for i in range(n+1):
y = int(a*i/b) - a*int(i/b)
x.append(y)
else:
for i in range(b):
y = int(a*i/b) - a*int(i/b)
x.append(y)
x = sorted(x)
print((x[-1])) | 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()))
sum = 0
ans = 0
for i in range(1,n+1):
sum += (a*i)//b-a*(i//b)
ans = max(sum,ans)
sum = 0
print(ans) | A, B, N = list(map(int, input().split()))
ans = 0
x = min(B-1, N)
print(((A*x)//B-A*(x//B))) | p02696 |
import math
A, B, N = list(map(int, input().split()))
def fnc(x):
return math.floor(A*x*1.0/B) - A*math.floor(x*1.0/B)
if N < B:
print((fnc(N)))
else:
ans = 0
for i in range(B-1, N+1, B):
s = fnc(i)
if s > ans:
ans = s
print(ans) | import math
A, B, N = list(map(int, input().split()))
def fnc(x):
return math.floor(A*x*1.0/B) - A*math.floor(x*1.0/B)
if B == 1:
print((0))
elif N < B:
print((fnc(N)))
else:
ans = 0
for i in range(B-1, N+1, B):
s = fnc(i)
if s > ans:
ans = s
print(a... | p02696 |
import math
import decimal
a,b,n=list(map(int,input().split()))
ans=[]
for i in range(1,n+1):
x=decimal.Decimal(a*i/b)
y=decimal.Decimal(i/b)
c=math.floor(x)-a*math.floor(y)
ans.append(c)
print((max(ans))) | import math
import decimal
a,b,n=list(map(int,input().split()))
if b<=n:
x=decimal.Decimal(a*(b-1)/b)
c=math.floor(x)
print(c)
else:
x=decimal.Decimal(a*n/b)
c=math.floor(x)
print(c) | p02696 |
from math import floor, ceil
a, b, n = list(map(int, input().split()))
ans = 10 ** 6 * (-1)
x = 1
while x <= n:
tmp = floor(a * x / b) - a * floor(x / b)
ans = max(ans, tmp)
x += ceil(b / a)
print(ans)
| from math import floor
a, b, n = list(map(int, input().split()))
x = min(b - 1, n)
ans = floor(a * x / b) - a * floor(x / b)
print(ans)
| p02696 |
A, B, N = list(map(int, input().split()))
mx = 0
count = 0
for a in range(N, -1, -1):
count += 1
new = int(A*a/B) - A*int(a/B)
mx = max(mx, new)
print(mx)
| A, B, N = list(map(int, input().split()))
x = min(B-1, N)
ans = int(A*x/B) - A*int(x/B)
print(ans)
| p02696 |
import math
a , b , n = list(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)
| import math
a , b , n = list(map(int , input().split()))
ans = 0
if n < b - 1:
x = n
ans = math.floor(a * (x % b) / b)
else:
x = b-1
ans = math.floor(a * (x % b) / b)
print(ans) | p02696 |
A,B,N = list(map(int,input().split()))
S =[]
for i in range(N+1):
S.append(int(A*i/B)-A*(int(i/B)))
print((max(S))) | A,B,N = list(map(int,input().split()))
if B>N:
print((int(A*N/B)-A*(int(N/B))))
else:
print((int(A*(B-1)/B)-A*(int((B-1)/B)))) | p02696 |
A, B, N = list(map(int, input().split()))
l = -1
r = N
# ans = 0
# for i in range(1, N+1):
# ans = max(ans, (A*i)//B - (A*(i//B)))
ans2 = (A*N)//B - (A*(N//B))
for i in range(B-1, N, B):
ans2 = max(ans2, (A*i)//B - (A*(i//B)))
print(ans2)
| A, B, N = list(map(int, input().split()))
l = -1
r = N
# ans = 0
# for i in range(1, N+1):
# ans = max(ans, (A*i)//B - (A*(i//B)))
k = min(B-1, N)
ans2 = (A*k)//B - (A*(k//B))
print(ans2)
| p02696 |
import math
def f(a, b, x):
return math.floor(a*x/b) - 5 * math.floor(x/b)
a, b, n = list(map(int, input().split()))
max = 0
for i in range(b):
if i > n:
break
elif f(a, b, i) > max:
max = f(a, b, i)
print(max) | import math
def f(a, b, x):
return math.floor(a*x/b) - 5 * math.floor(x/b)
a, b, n = list(map(int, input().split()))
max = 0
if b <= n:
print((f(a, b, b-1)))
else:
print((f(a, b, n))) | p02696 |
def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
from collections import defaultdict
from sys import exit
import math
def main():
a,b,x = getList()
if x < b:
print((math.floor( (a... | import sys
# from collections import defaultdict, deque
import math
# import copy
# from bisect import bisect_left, bisect_right
# import heapq
# sys.setrecursionlimit(1000000)
# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(eval(input()))
getList = lambda: ... | p02696 |
import sys
A,B,N=list(map(int,input().split()))
X=B-1
ans=(A*N)//B-A*(N//B)
if B==1:
print((0))
sys.exit()
while X<=N:
ans=max(ans,(A*X)//B-A*(X//B))
X+=B
print(ans) | import sys
A,B,N=list(map(int,input().split()))
X=B-1
X=min(B-1,N)
ans=(A*X)//B-A*(X//B)
print(ans) | p02696 |
a, b, n = list(map(int, input().split()))
if b > n:
ans = (a*n)//b
else:
ans = 0
for i in range(n//b +1):
result = a*(b*(i+1)-1)//b - a*i
if result > ans:
ans = result
print(ans) | a, b, n = list(map(int, input().split()))
print((int(a*min(n,b-1)/b))) | p02696 |
import sys
import math
from collections import Counter
import itertools
import fractions
#from functools import reduce
# 入力を整数に変換して受け取る
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())
# 入力全てを整数に変換したも... | import sys
import math
from collections import Counter
import itertools
import fractions
#from functools import reduce
# 入力を整数に変換して受け取る
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())
# 入力全てを整数に変換したも... | p02696 |
"""
import random
import functools
import copy
import bisect
import array
import re
import collections
import heapq
import fractions
import itertools
import string
import math
from operator import itemgetter as ig
from bisect import bisect_left, bisect_right, insort_left, insort_right
from itertools impo... | """
import random
import functools
import copy
import bisect
import array
import re
import collections
import heapq
import fractions
import itertools
import string
import math
from operator import itemgetter as ig
from bisect import bisect_left, bisect_right, insort_left, insort_right
from itertools impo... | p02696 |
a,b,n=list(map(int,input().split()))
ans=[]
for i in range(n+1):
ans.append(a*i//b-a*(i//b))
print((max(ans))) | a,b,n=list(map(int,input().split()))
if b-1>n:
ans=n
else:
ans=b-1
print((a*ans//b-a*(ans//b))) | p02696 |
# ABC 165 D - Floor Function
a,b,n = list(map(int, input().split()))
l =[(int((a/b)*(i+1)) - a*int((i+1)/b)) - (int((a/b)*(i)) - a*int((i)/b)) for i in range(1, n+1)]
left = 0
right = n-1
mid = (left+right)//2
while right - left > 1:
if l[mid] <= 0:
right = mid
mid = (left+right)//2
... | # ABC 165 D - Floor Function
a,b,n = list(map(int, input().split()))
def func(i):
return int(i*a/b) - a*int(i/b)
print((func(min(b-1, n)))) | p02696 |
import math
a, b, n = [int(x) for x in 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) | import math
a, b, n = [int(x) for x in input().split()]
# a = 10 ** 6
# b = 10 ** 12
# n = 10 ** 12
m = 0
if (n < b):
# math.floor(x / b) = 0
m = math.floor(a * n / b) # - a * math.floor(n / b)
else:
m = math.floor(a * (b - 1) / b) - a * math.floor((b - 1) / b)
#for i in range(n // b - 1,... | p02696 |
import math
a,b,n = list(map(int, input().split()))
l = []
for i in range(n + 1):
c = math.floor(a * i / b) - a * math.floor(i / b)
l.append(c)
print((max(l))) | from math import floor
a,b,n = list(map(int, input().split()))
if n < b:
c = floor(a * n / b) - a * floor(n / b)
else:
c = floor(a * (b - 1) / b) - a * floor((b - 1) / b)
print(c) | p02696 |
import sys
import math
def IL(): return list(map(int,sys.stdin.readline().rstrip().split()))
def Main():
a,b,n = IL()
x = min(b-1,n)
print((math.floor(a*x/b)-a*math.floor(x/b)))
return
if __name__=='__main__':
Main() | import sys
import math
def IL(): return list(map(int,sys.stdin.readline().rstrip().split()))
def Main():
a,b,n = IL()
x = min(b-1,n)
print((a*x//b))
return
if __name__=='__main__':
Main() | p02696 |
import math
li = list(map(int,input().split()))
def main():
max = 0
for i in range(li[2]+1):
l = (math.floor((li[0]*i)/li[1]) - li[0]*(math.floor(i/li[1])))
if l > max:
max = l
return(print(max))
main()
| import math
A, B, N = list(map(int, input().split()))
x = 0
if N < B:
x = N
else:
x = B - 1
print((math.floor(A * x / B) - A * math.floor(x / B))) | p02696 |
A, B, N = list(map(int, input().split()))
ans = 0
for x in range(1,min(B,N)+1):
buf = ((A*x)//B) - (A*(x//B))
ans = max(ans,buf)
print(ans) | A, B, N = list(map(int, input().split()))
ans = 0
x = min(B-1,N)
print(((A*x)//B)) | p02696 |
import math
A, B, N = list(map(int,input().split()))
max_value = 0
n = min(N, B-1)
for i in range(1, n+1):
tmp = math.floor(A*i/B) - A* math.floor(i/B)
if tmp >= max_value:
max_value = tmp
print(max_value) | import math
A, B, N = list(map(int,input().split()))
max_value = 0
n = min(N, B-1)
max_value = math.floor(A*n/B) - A* math.floor(n/B)
print(max_value) | p02696 |
A,B,N = [int(i) for i in input().split()]
x = N
M = A*N//B
ans = -float("inf")
for _ in range(min([10**7,N])):
s = (A*x)//B - A*(x//B)
ans = max([ans,s])
x -= 1
print(ans) | A,B,N = [int(i) for i in input().split()]
t = min([N,B-1])
print((A*t//B)) | p02696 |
A,B,N=list(map(int, input().split()))
print((A*min(B-1,N)//B)) | A, B, N = list(map(int, input().split()))
m = B - 1 if N >= B else N
print((A * m // B))
| p02696 |
import math
A, B, N = list(map(int, input().split()))
max = 0
temp = 0
bk_temp = 0
if B <= N:
max = math.floor(A * (B - 1) / B) - (A * math.floor((B - 1) / B))
else:
for i in range(1, N + 1):
temp = math.floor(A*i/B) - (A * math.floor(i/B))
# print(str(i) + ' ' + str(temp))
... | import math
A, B, N = list(map(int, input().split()))
max = 0
temp = 0
bk_temp = 0
if B <= N:
max = math.floor(A * (B - 1) / B) - (A * math.floor((B - 1) / B))
else:
# for i in range(1, N + 1):
# temp = math.floor(A*i/B) - (A * math.floor(i/B))
# print(str(i) + ' ' + str(temp))
... | p02696 |
import math
mat =[]
a, b, n = list(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))) | a, b, n = list(map(int, input().split()))
x = min(b-1, n)
s = (a*x) // b - a * (x // b)
print(s) | p02696 |
a, b, n = list(map(int, input().split()))
def func(i, j, k):
return (i*k)//j - i*(k//j)
ans = 0
for i in range(1, min(b+1, n+1)):
if func(a, b, i) > ans:
ans = func(a, b, i)
print(ans) | a, b, n = list(map(int, input().split()))
def func(i, j, k):
return (i*k)//j - i*(k//j)
m = min(n, b-1)
r = (a*min(n, b-1)) // b
while ((a*m) // b) == r:
m -= 1
print((func(a, b, m+1))) | p02696 |
A,B,N = list(map(int, input().split()))
ans = -1145141919810931931
Flag = True
for x in range(1, N+1, max(1, int(B/A) - 1)):
a = int(A*x/B) - A*int(x/B)
if a>=ans:
ans = a
Flag = True
elif Flag:
Flag = False
else:
break
a = int(A*N/B) - A*int(N/B)
if a>ans:... | A,B,N = list(map(int, input().split()))
ans = 0
if N >= B:
ans = int(A*(2*B-1)/B) - A*int((2*B-1)/B)
else:
ans = int(A*N/B)
print(ans) | p02696 |
import math
def main():
A, B, N = list(map(int, input().split()))
def target(x):
# print(math.floor(A * x / B))
# print(A * math.floor(x / B))
return math.floor(A * x / B) - A * math.floor(x / B)
max_value = -1
for i in range(1, min(N+1, B + 1)):
v = targ... | import math
def main():
A, B, N = list(map(int, input().split()))
def target(x):
# print(math.floor(A * x / B))
# print(A * math.floor(x / B))
return math.floor(A * x / B) - A * math.floor(x / B)
print((target(min(N, B-1))))
# B_A = 1.0 * B / A
#
# max... | p02696 |
from math import floor
a,b,n = list(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) | def f(x): return int(a * x / b) - a * int(x / b)
a, b, n = list(map(int, input().split()))
print((f(min(b - 1, n))))
| p02696 |
A,B,N=list(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) | A,B,N=list(map(int,input().split()))
x=(N//B)*B-1
ans=(A*N)//B - A*(N//B)
if N>=B:
ans=max(ans, (A*x)//B - A*(x//B))
print(ans) | 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()))
def f(x):
return int(A*x/B)-A*int(x/B)
print((f(min(N,B-1)))) | p02696 |
import sys
from math import sqrt, floor
from collections import Counter, defaultdict, deque
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(MI())
def LIN(n: int):
... | import sys
from math import sqrt, floor
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def main():
a, b, n = MI()
if b - 1 <= n:
print(((a * (b - 1)) // b - (a * ((b - 1) // ... | p02696 |
A,B,N = list(map(int,input().split()))
def floor(x):
return int(x//1)
list = []
if N >= B:
for x in range(B+1):
list.append(floor((A*x)/B)-(A*floor(x/B)))
else:
list.append(floor((A*N)/B)-(A*floor(N/B)))
print((max(list)))
| A,B,N = list(map(int,input().split()))
def floor(x):
return int(x//1)
list = []
if N >= B:
list.append(floor((A*(B-1))/B)-(A*floor((B-1)/B)))
else:
list.append(floor((A*N)/B)-(A*floor(N/B)))
print((max(list))) | p02696 |
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) | 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)
"""
print((fun... | p02696 |
import math
a,b,n = list(map(int, input().split()))
maxVal = 0
for i in range(b):
if i > n:
break
val = math.floor(a*i/b)-a*math.floor(i/b)
if val > maxVal:
maxVal = val
print(maxVal) | import math
a,b,n = list(map(int, input().split()))
if b <= 10**6:
maxVal = 0
for i in range(b):
if i > n:
break
val = math.floor(a*i/b)-a*math.floor(i/b)
if val > maxVal:
maxVal = val
print(maxVal)
elif n > b:
print((a-1))
elif n == b... | p02696 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.