problem_id
stringlengths
6
6
user_id
stringlengths
10
10
time_limit
float64
1k
8k
memory_limit
float64
262k
1.05M
problem_description
stringlengths
48
1.55k
codes
stringlengths
35
98.9k
status
stringlengths
28
1.7k
submission_ids
stringlengths
28
1.41k
memories
stringlengths
13
808
cpu_times
stringlengths
11
610
code_sizes
stringlengths
7
505
p02696
u442855260
2,000
1,048,576
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.
['import numpy as np\nA,B,N=map(int,input().split())\nx = np.array([j for j in range(B+1)])\nval=np.floor(A*x/B)-A*np.floor(x/B)\nprint(int(np.max(val)))', 'import math\nA,B,N=map(int,input().split())\nif(N<B):\n x = N\nelse:\n x =B-1 \n\nprint(int( math.floor(A*x/B)-A*math.floor(x/B) ))']
['Wrong Answer', 'Accepted']
['s442691935', 's288834220']
[2078780.0, 9176.0]
[2279.0, 20.0]
[147, 134]
p02696
u442877951
2,000
1,048,576
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.
['A,B,N = map(int,input().split())\nans = 0\nif B <= N:\n for x in range(B-1,N+1,B):\n ans = max(ans, (A*x)//B - A*(x//B))\nelse:\n ans = floor((A*N)/B) - A*floor(N/B)\nprint(ans)', 'from math import floor\nA,B,N = map(int,input().split())\nans = 0\nif B <= N:\n ans = floor(A*(B-1)/B) - A*floor((B-1)/B)\nelse:\n ans = floor((A*N)/B) - A*floor(N/B)\nprint(ans)']
['Runtime Error', 'Accepted']
['s911056871', 's938809050']
[9208.0, 9180.0]
[2205.0, 22.0]
[176, 174]
p02696
u449822557
2,000
1,048,576
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.
['import math\na, b, n = list(map(int,input().split()))\nif b > n:\n print(math.floor(a*n/b))\nelif n < 2*b - 1:\n print(max(math.floor(a*n/b)-a,math.floor(a*(b-1)/b))\nelse:\n print(a+math.floor((-1)*a/b))', 'import math\na, b, n = list(map(int,input().split()))\nif b > n:\n print(math.floor(a*n/b))\nelif n < 2*b - 1:\n print(max(math.floor(a*n/b)-a,math.floor(a*(b-1)/b)))\nelse:\n print(a+math.floor((-1)*a/b))']
['Runtime Error', 'Accepted']
['s331479559', 's045043882']
[8912.0, 9192.0]
[26.0, 23.0]
[206, 207]
p02696
u451206510
2,000
1,048,576
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.
['import math\nA,B,N = map(int, input().split())\nprint(math.floor((A*(B-1))/B) - A*math.floor((B-1)/B))', 'import math\nA,B,N = map(int, input().split())\nprint(math.floor((A*(B-1))/B) - A*math.floor((B-1)//B))\n', 'import math\nA,B,N = map(int, input().split())\n\nif (B-1) <= N:\n print(math.floor((A*(B-1))/B) - A*math.floor((B-1)/B))\nelse:\n print(math.floor(A*N/B) - A*math.floor(N/B))\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s161053046', 's783334187', 's281560437']
[9148.0, 9032.0, 9176.0]
[23.0, 22.0, 22.0]
[100, 102, 176]
p02696
u453634575
2,000
1,048,576
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.
['a, b,n = list(map(int, input().split()))\nres = 0\nfor x in range(1, n+1):\n print((a*x)//b, a *(x//b) )\n if a *(x//b) != 0:\n break\n if res < (a*x)//b - a *(x//b):\n res = (a*x)//b - a *(x//b)\n\nprint(res)', 'a, b,n = list(map(int, input().split()))\nif b > n:\n print((a*n)//b - a *(n//b))\nelif b <= n:\n print((a*(b-1))//b )']
['Wrong Answer', 'Accepted']
['s978189111', 's006597363']
[13092.0, 9172.0]
[2223.0, 21.0]
[224, 120]
p02696
u455957070
2,000
1,048,576
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.
['a,b,n = map(int, input().split())\nfor i in range(b-1):\n tmp = (a*i) // b - a*(i // b)\n ans = 0\n ans = max(tmp,ans)\nprint(ans)', 'import math\na, b, n = map(int, input().split())\nx = min(b-1, n)\nprint(math.floor(a*x/b)-a*math.floor(x/b))']
['Runtime Error', 'Accepted']
['s813735725', 's150048787']
[9116.0, 9160.0]
[2205.0, 24.0]
[128, 106]
p02696
u463864151
2,000
1,048,576
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.
['# -*- coding: utf-8 -*-\n"""\n@author: H_Hoshigi\n"""\ndef main():\n N, M, Q = map(int, input().split())\n r_list = []\n for i in range(Q):\n r_list.append(list(map(int, input().split())))\n max_score = 0\n a1 = 1\n for a2 in range(a1, M+1):\n for a3 in range(a2, M+1):\n for a4 in range(a3, M+1):\n for a5 in range(a4, M+1):\n for a6 in range(a5, M+1):\n for a7 in range(a6, M+1):\n for a8 in range(a7, M+1):\n for a9 in range(a8, M+1):\n for a10 in range(a9, M+1):\n a_list = [a1,a2,a3,a4,a5,a6,a7,a8,a9,a10]\n score = 0\n for r in r_list:\n if a_list[r[1]-1] - a_list[r[0]-1] == r[2]:\n score += r[3]\n max_score = max(score, max_score)\n print(max_score)\n\nif __name__ == "__main__":\n main()\n\n\n', '# -*- coding: utf-8 -*-\n"""\n@author: H_Hoshigi\n"""\nimport math\nA, B, N = map(int, input().split())\n\ndef f(x):\n return math.floor(A*x/B) - A * math.floor(x/B)\n\ndef main():\n print(f(min(N, B-1)))\n\nif __name__ == "__main__":\n main()\n\n']
['Runtime Error', 'Accepted']
['s675286168', 's328807110']
[9264.0, 9180.0]
[20.0, 22.0]
[1116, 240]
p02696
u464205401
2,000
1,048,576
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.
['a,b,n=list(map(int,input().split()))\n\n#for x in range(n+1):\nx=b-1\nans=int(a*x/b)-a*int(x/b)\nprint(ans)', 'a,b,n=list(map(int,input().split()))\nx=n-1 if b==n else b-1 if n-1>=b else n\nprint(int(a*x/b)-a*int(x/b))']
['Wrong Answer', 'Accepted']
['s125809150', 's754641609']
[8976.0, 9164.0]
[22.0, 23.0]
[102, 105]
p02696
u464627439
2,000
1,048,576
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.
['a, b, n = map(int, input().split())\n\nx = 0\nbuf = []\nwhile True:\n calc = int(a * x / b) - a * int(x / b)\n buf.append(calc)\n \n\n if a < x:\n break\n x += 1\n\nans = max(buf)\nprint(ans)', 'a, b, n = map(int, input().split())\n\ncnt = 1\nbuf = []\nbuf.append(int(a * n / b) - a * (int(n / b)))\n\nwhile True:\n if n / b > 10 ** 6:\n break\n x = cnt * b - 1\n if n < x :\n break\n calc = int(a * x / b) - a * (int(x / b))\n if calc > max(buf):\n buf.append(calc)\n cnt += 1\n \nbuf.append(int(a * (b - 1) / b) - a * (int((b - 1) / b)))\n\nans = max(buf)\nprint(ans)', 'a, b, n = map(int, input().split())\n\ncnt = 1\nbuf = []\nif n < b:\n buf.append(int(a * n / b) - a * (int(n / b)))\nelse:\n buf.append(int(a * (b - 1) / b) - a * (int((b - 1) / b)))\n \n\nwhile True:\n if n / b > 10 ** 6:\n break\n x = cnt * b - 1\n if n < x :\n break\n calc = int(a * x / b) - a * (int(x / b))\n if calc > max(buf):\n buf.append(calc)\n cnt += 1\n \nif n / b > 10 ** 6 and n >= b:\n buf.append(int(a * (b - 1) / b) - a * (int((b - 1) / b)))\n\nans = max(buf)\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s566670420', 's811057942', 's214119967']
[17012.0, 9216.0, 9176.0]
[531.0, 21.0, 22.0]
[199, 396, 518]
p02696
u469936642
2,000
1,048,576
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.
['a, b, n = map(int, input().split())\n\nif b == 1 or a == 1:\n print(0)\nelse:\n r = min(b-1, n) \n s = (a * r) // b - a * (r // b)\n print(r)', 'a, b, n = map(int, input().split()) \nif b == 1 or a == 1: \n print(0) \nelse: \n r = min(b-1, n) \n s = (a * r) // b - a * (r // b) \n print(s)\n']
['Wrong Answer', 'Accepted']
['s850673094', 's137562524']
[9124.0, 9032.0]
[21.0, 24.0]
[146, 154]
p02696
u473430959
2,000
1,048,576
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.
['import math\nA,B,N= map(int,input().split())\n\n \n\nmax=0\nfor i in reversed(range(1, N+1)):\n y=float(math.floor(A*i/B))-A*float((math.floor(i/B)))\n if max < y :\n max=y\nprint(max)\n ', 'import math\nA,B,N= map(int,input().split())\n\nmax=0\nif N>B:\n N=B-1\n y=math.floor(A*N/B)-A*math.floor(N/B)\n print(int(y))\nelif N==B:\n N=B-1\n y=math.floor(A*N/B)-A*math.floor(N/B)\n print(int(y))\nelse:\n\ty=math.floor(A*N/B)-A*math.floor(N/B)\n\tprint(int(y))\n ']
['Wrong Answer', 'Accepted']
['s048063762', 's863452277']
[9176.0, 9200.0]
[2205.0, 24.0]
[183, 260]
p02696
u477977638
2,000
1,048,576
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.
['a,b,n=map(int,input().split())\n\nx=max(b-1,n)\nprint((a*x)//b)\n', 'a,b,n=map(int,input().split())\nx=min(b-1,n)\nprint((a*x)//b)']
['Wrong Answer', 'Accepted']
['s138556420', 's711440503']
[9152.0, 9104.0]
[24.0, 23.0]
[61, 59]
p02696
u479638406
2,000
1,048,576
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.
['import math\ndef solve():\n a, b, n = map(int, input().split())\n\n ans = 0\n for x in range(-1, n+1, b):\n ans = max(ans, math.floor(a*x/b) - a*math.floor(x/b))\n\n\n return ans\n\n\nprint(solve())\n', 'import math\ndef solve():\n a, b, n = map(int, input().split())\n\n if n < b:\n return math.floor(a*n/b) - a*math.floor(n/b)\n elif n >= b:\n return math.floor(a*(b-1)/b) - a*math.floor((b-1)/b)\n\n\n\nprint(solve())\n']
['Wrong Answer', 'Accepted']
['s102756621', 's228791954']
[9088.0, 9180.0]
[2205.0, 21.0]
[206, 229]
p02696
u481187938
2,000
1,048,576
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.
['#!usr/bin/env pypy3\nfrom collections import defaultdict, deque\nfrom heapq import heappush, heappop\nfrom itertools import permutations, accumulate, combinations_with_replacement, compress\nimport sys\nimport math\nimport bisect\n\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\n\n\ndef I(): return int(sys.stdin.readline())\n\n\ndef LS(): return [list(x) for x in sys.stdin.readline().split()]\n\n\ndef S():\n res = list(sys.stdin.readline())\n if res[-1] == "\\n":\n return res[:-1]\n return res\n\n\ndef IR(n):\n return [I() for i in range(n)]\n\n\ndef LIR(n):\n return [LI() for i in range(n)]\n\n\ndef SR(n):\n return [S() for i in range(n)]\n\n\ndef LSR(n):\n return [LS() for i in range(n)]\n\n\nsys.setrecursionlimit(1000000)\n\n\ndef main():\n N, M, Q = LI()\n abcd = [LI() for _ in range(Q)]\n ans = 0\n\n for A in combinations_with_replacement(range(1, M + 1), N):\n tmp = 0\n for (a, b, c, d) in abcd:\n tmp += d if (A[b-1] - A[a-1] == c) else 0\n ans = max(ans, tmp)\n print(ans)\n\n\nmain()\n', 'from collections import defaultdict, deque\nfrom heapq import heappush, heappop\nfrom itertools import permutations, accumulate, combinations_with_replacement, compress\nimport sys\nimport math\nimport bisect\n\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\n\n\ndef I(): return int(sys.stdin.readline())\n\n\ndef LS(): return [list(x) for x in sys.stdin.readline().split()]\n\n\ndef S():\n res = list(sys.stdin.readline())\n if res[-1] == "\\n":\n return res[:-1]\n return res\n\n\ndef IR(n):\n return [I() for i in range(n)]\n\n\ndef LIR(n):\n return [LI() for i in range(n)]\n\n\ndef SR(n):\n return [S() for i in range(n)]\n\n\ndef LSR(n):\n return [LS() for i in range(n)]\n\n\nsys.setrecursionlimit(1000000)\n\n\ndef main():\n N, M, Q = LI()\n abcd = [LI() for _ in range(Q)]\n ans = 0\n\n for A in combinations_with_replacement(range(1, M + 1), N):\n tmp = 0\n for (a, b, c, d) in abcd:\n tmp += d if (A[b-1] - A[a-1] == c) else 0\n ans = max(ans, tmp)\n print(ans)\n\n\nmain()\n', 'from collections import defaultdict, deque\nfrom heapq import heappush, heappop\nfrom itertools import permutations, accumulate, combinations_with_replacement, compress\nimport sys\nimport math\nimport bisect\n\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\n\n\ndef I(): return int(sys.stdin.readline())\n\n\ndef LS(): return [list(x) for x in sys.stdin.readline().split()]\n\n\ndef S():\n res = list(sys.stdin.readline())\n if res[-1] == "\\n":\n return res[:-1]\n return res\n\n\ndef IR(n):\n return [I() for i in range(n)]\n\n\ndef LIR(n):\n return [LI() for i in range(n)]\n\n\ndef SR(n):\n return [S() for i in range(n)]\n\n\ndef LSR(n):\n return [LS() for i in range(n)]\n\n\nsys.setrecursionlimit(1000000)\n\n\ndef main():\n A, B, N = LI()\n print(int(A / B * min(N, B - 1)))\n\n\nmain()\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s108459842', 's920866132', 's940095034']
[83000.0, 80400.0, 9424.0]
[2209.0, 2209.0, 35.0]
[1043, 1023, 801]
p02696
u482743994
2,000
1,048,576
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.
['print(0)', 'from math import ceil\na,b,n=map(int,input().split())\np=n//b\nif p==0:\n print((a*n)//b)\nelse:\n print(a-ceil(a/b))\n']
['Wrong Answer', 'Accepted']
['s571643230', 's799278744']
[9004.0, 9164.0]
[18.0, 23.0]
[8, 114]
p02696
u488884575
2,000
1,048,576
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.
['a,b,n = list(map(int, input().split()))\nx = b-1\nt = int(a*x/b) -a*int(x/b)\n\n\nprint(t)\n', 'a,b,n = list(map(int, input().split()))\nx = b-1\nt = int(a*x//b) -a*int(x//b)\n\n\nprint(t)\n', 'a,b,n = list(map(int, input().split()))\nx = b-1\nif x < n:\n t = int(a*x//b) -a*int(x//b)\nelse:\n t = int(a*n//b) -a*int(n//b)\n\nprint(t)\n\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s500356876', 's681494270', 's602953395']
[9060.0, 9092.0, 9112.0]
[20.0, 24.0, 24.0]
[86, 88, 141]
p02696
u491762407
2,000
1,048,576
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.
['a,b,n = map(int,input().split())\n\nx = math.floor(a*n/b)-( a*math.floor(n/b))\ny = math.floor(a*b/b)-( a*math.floor(b/b))\nz = math.floor(a*(b-1)/b)-( a*math.floor((b-1)/b))\n\nif b == 1:\n print(0)\nelif n < b:\n print(x)\nelse:\n print(z)', 'a,b,n = map(int,input().split())\n\nif b == 1:\n print(0)\nelif n < b:\n print(math.floor(a*n/b)+math.floor(n/b))\nelse:\n print(math.floor(a*(b-1)/b)+math.floor((b-1)/b))', 'import math\na,b,n = map(int,input().split())\n\nx = math.floor(a*n/b)-( a*math.floor(n/b))\ny = math.floor(a*b/b)-( a*math.floor(b/b))\nz = math.floor(a*(b-1)/b)-( a*math.floor((b-1)/b))\n\nif b == 1:\n print(0)\nelif n < b:\n print(x)\nelse:\n print(z)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s069590930', 's184217141', 's234097508']
[9196.0, 9172.0, 9196.0]
[20.0, 22.0, 20.0]
[239, 173, 251]
p02696
u492959898
2,000
1,048,576
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.
['a,b,n=map(int,(inpur().split())\nx = min(b-1,n)\nprint(int(a*x/b)-a*int(x/b))', 'a,b,n=map(int,input().split())\nx = min(b-1,n)\nprint(int(a*x/b)-a*int(x/b))']
['Runtime Error', 'Accepted']
['s666666522', 's061205867']
[8928.0, 9012.0]
[21.0, 20.0]
[75, 74]
p02696
u493318999
2,000
1,048,576
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.
['import math\na,b,n = map(int,input().split())\nans = -10000000000 \nfor i in range(0,n+1):\n kari = math.floor(a*i/b) - a*math.floor(i/b)\n if ans < kari:\n ans = kari\n else:\n break\nprint(ans)', 'import math\na,b,n = map(int,input().split())\nif b <= n:\n print(math.floor(a*(b-1)/b)-a*math.floor((b-1)/b))\nelse:\n print(math.floor(a*n/b)-a*math.floor(n/b))']
['Wrong Answer', 'Accepted']
['s675161342', 's710604762']
[9176.0, 9172.0]
[25.0, 22.0]
[209, 163]
p02696
u494058663
2,000
1,048,576
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.
['from decimal import Decimal\nimport math\na,b,n = map(str,input().split())\n\na = Decimal(a)\nb = Decimal(b)\nn = int(n)\nans = 0\nkouho = [b-1,b,n-1,n]\nfor x in kouho:\n tmp = math.floor((a*x)/b) - a*math.floor(x/b)\n ans = max(ans,tmp)\nprint(ans)', 'from decimal import Decimal\nimport math\na,b,n = map(str,input().split())\n\na = Decimal(a)\nb = Decimal(b)\nn = int(n)\nans = 0\nkouho = [min(b-1,n)]\nfor x in kouho:\n tmp = math.floor((a*x)/b) - a*math.floor(x/b)\n ans = max(ans,tmp)\nprint(ans)']
['Wrong Answer', 'Accepted']
['s343890509', 's905957204']
[9944.0, 10068.0]
[28.0, 24.0]
[244, 243]
p02696
u497805118
2,000
1,048,576
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.
['a, b, n = map(int, input().split(" "))\n\nprint(max([math.floor(a * i / b) - a * math.floor(i / b) for i in range(1, n + 1)]))\n', 'import math\n \na, b, n = map(int, input().split(" "))\ni = min([b-1 , n])\nprint( math.floor(a*i / b) - a * math.floor(i / b) )']
['Runtime Error', 'Accepted']
['s069080879', 's076737078']
[9100.0, 9172.0]
[22.0, 22.0]
[125, 124]
p02696
u505025514
2,000
1,048,576
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.
['l = list(map(int,input().split()))\na = l[0]\nb = l[1]\nn = l[2]\n\ndef floor(a,b,x):\n p = (a*x)//b - a*(x//b)\n return p\n\nmax = 0\nmaxn = 0\nfor i in range(n+1):\n c = floor(a,b,i)\n if c >= max:\n max = c\n maxn = i\n\nprint(maxn)', 'l = list(map(int,input().split()))\na = l[0]\nb = l[1]\nn = l[2]\n\ndef floor(a,b,x):\n p = (a*x)//b - a*(x//b)\n return p\n\nmax = 0\nif b == 1:\n max = 0\nelif n <= b-1:\n max = floor(a,b,n)\nelif n > b-1:\n for i in range(b-1,n+1,b):\n c = floor(a,b,i)\n if c >= max:\n max = c\n\nprint(max)']
['Wrong Answer', 'Accepted']
['s891843817', 's417765269']
[9112.0, 9212.0]
[2205.0, 19.0]
[244, 314]
p02696
u508164527
2,000
1,048,576
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.
['import math\nA,B,N = (int(x) for x in input().split())\na = (N//B)*B-1\nif a < 0:\n ans = math.floor(A*0/B) - A*math.floor(0/B)\nelse:\n ans = math.floor(A*a/B) - A*math.floor(a/B)\nif ans > math.floor(A*N/B)-A*math.floor(a/B):\n re = ans\nelse:\n re = math.floor(A*N/B)-A*math.floor(a/B)\nprint(re)\n\n', 'import math\nA,B,N = (int(x) for x in input().split())\na = (N//B)*B-1\nif a < 0:\n a = 0\n ans = (A*a)//B - A*math.floor(a/B)\nelse:\n ans = (A*a)//B - A*math.floor(a/B)\n\nif ans < (A*N)//B - A*math.floor(N/B):\n re = (A*N)//B - A*math.floor(N/B)\nelse:\n re = ans\nprint(re)\n\n']
['Wrong Answer', 'Accepted']
['s934685683', 's923682522']
[9136.0, 9100.0]
[21.0, 24.0]
[294, 271]
p02696
u509405951
2,000
1,048,576
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.
['import numpy as np\nA, B, N = map(int, input().split())\n\nx = np.arange(1, max(10**6,N+1))\nprint(int(np.max(np.floor(A*x/B)-A*np.floor(x/B))))', 'import math\nA, B, N = map(int, input().split())\n\nif (B == 1):\n print(0)\nelif (B > N+1):\n x = N\n print((A*x)//B-A*(x//B))\nelse:\n x = N-N%(B-1)\n print((A*x)//B-A*(x//B))']
['Runtime Error', 'Accepted']
['s210350949', 's258572769']
[58320.0, 9188.0]
[125.0, 22.0]
[140, 172]
p02696
u511268447
2,000
1,048,576
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.
["if __name__ == '__main__':\n from sys import stdin\n # from collections import defaultdict\n import math\n input = stdin.readline\n\n import random\n\n while True:\n # a, b, n = map(int, input().split())\n a = random.randint(1, 10**6)\n b = random.randint(1, 10**12)\n n = random.randint(1, 10**12)\n if b > n:\n print(int(math.floor(a*n/b)-a*math.floor(n/b)))\n exit()\n\n if b >= 10**6:\n ans = 0\n for i in (b-1, n+1, b):\n temp = math.floor(a*i/b)-a*math.floor(i/b)\n if ans < temp:\n ans = temp\n print(int(ans))\n exit()\n\n ans = int(math.floor(a*n/b)-a*math.floor(n/b))\n i = math.floor(n/b)*b-1\n for _ in range(2*10**6):\n temp = math.floor(a*i/b)-a*math.floor(i/b)\n if ans < temp:\n ans = temp\n i -= b\n if i <= 0:\n print(int(ans))\n exit()\n print(int(ans))\n\n\n\n", 'if __name__ == \'__main__\':\n from sys import stdin\n # from collections import defaultdict\n import math\n input = stdin.readline\n\n # import random\n\n a, b, n = map(int, input().split())\n """\n a = random.randint(1, 10**6)\n b = random.randint(1, 10**6)\n n = random.randint(1, 10**12)\n """\n # print(a, b, n)\n \n if b > n:\n # print(\'a\')\n print(int(math.floor((a*n)/b) - a*math.floor(n/b)))\n exit()\n print(int(math.floor((a*(b-1))/b)))']
['Wrong Answer', 'Accepted']
['s096777237', 's104911252']
[9500.0, 9136.0]
[22.0, 21.0]
[1035, 492]
p02696
u511379665
2,000
1,048,576
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.
['from math import gcd\n\na,b,n=map(int,input().split())\nt=a*b//gcd(a,b)\n\nans=[]\n\nfor i in range(1,t+1):\n y=int(a*i/b)-a*int(i/b)\n ans.append(y)\n\nn%=t\nans=ans[:t]\nprint(max(ans))\n', '\na,b,n=map(int,input().split())\n\ndef f(x):\n return a*x//b-a*(x//b)\n\nprint(f(min(n,b-1)))']
['Wrong Answer', 'Accepted']
['s341870297', 's512880065']
[192620.0, 9192.0]
[2211.0, 18.0]
[181, 91]
p02696
u513929200
2,000
1,048,576
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.
['A = int(input())\nB = int(input())\nN = int(input())\nprint(int(A*(N-1)/B)-A*int((N-1)/B))', 'A = int(input())\nB = int(input())\nN = int(input())\nprint(int(A*(N-1)/B)-A*int((N-1)/B))', 'A,B,N=map(int,input().split())\nif N+1>=B:\n T=int(A*(B-1)/B)\n print(T)\nelse:\n T=int(A*N/B)\n print(T)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s863206827', 's903569964', 's475560360']
[9164.0, 9168.0, 9172.0]
[24.0, 21.0, 23.0]
[87, 87, 111]
p02696
u515874757
2,000
1,048,576
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.
['a,b,n=map(int, input().split())\nprint(max(list( a*x/b//1 - x/b//1*a for x in range(1,n+1) )))\n', 'a,b,n=map(int, input().split())\n\nx=min(b-1,n)\n\nprint(int(a*x/b))']
['Wrong Answer', 'Accepted']
['s888051931', 's295430962']
[247568.0, 9092.0]
[2214.0, 20.0]
[94, 64]
p02696
u519339498
2,000
1,048,576
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.
["'''\nCreated on 2020/08/29\n\n@author: harurun\n'''\ndef main():\n import sys\n pin=sys.stdin.readline\n pout=sys.stdout.write\n perr=sys.stderr.write\n \n A,B,N=map(int,pin().split())\n t=int(B/A)\n ans=0\n for x in range(t,B+1):\n ans=max(ans,int(A*x/B)-A*int(x/B))\n print(ans)\n return \nmain()", "'''\nCreated on 2020/08/29\n\n@author: harurun\n'''\ndef main():\n import sys\n pin=sys.stdin.readline\n pout=sys.stdout.write\n perr=sys.stderr.write\n\n A,B,N=map(int,pin().split())\n x=min(B-1,N)\n ans=int(A*x/B)-A*int(x/B)\n print(ans)\n return\nmain()\n"]
['Wrong Answer', 'Accepted']
['s783555073', 's126242015']
[9132.0, 9080.0]
[2206.0, 29.0]
[294, 259]
p02696
u520843951
2,000
1,048,576
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.
['import time\n\ndef floor(y):\n return int(y)\n\ndef main():\n t1 = time.time()\n\n a, b, n = map(int, input().split())\n ans = [floor(a*x/b) - a*floor(x/b) for x in range(1, n+1)]\n print(max(ans))\n\n t2 = time.time()\n\n print(f"経過時間:{t2-t1}")\n\nif __name__ == "__main__":\n main()', 'import math\na, b, n = map(int, input().split())\nx = min(b-1, n)\nprint(math.floor(a*(x%b)/b))']
['Wrong Answer', 'Accepted']
['s778556192', 's946512114']
[58920.0, 9084.0]
[2207.0, 23.0]
[301, 92]
p02696
u521602455
2,000
1,048,576
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.
['A,B,N=map(int,input().split())\nans=0\nprint(int(A*(B-1)/B)-A*int((B-1)/B))\nif B>=N:\n for i in range(0,10**6):\n x=N-i\n if x<0:\n break\n tmp=int(A*x/B)-A*int(x/B)\n ans=max(ans,tmp)\n #print(ans)\nelif B<N:\n for i in range(0,10**6):\n x=N-i\n if x<0:\n break\n tmp=int(A*x/B)-A*int(x/B)\n ans=max(ans,tmp)\n for i in range(0,10**6):\n x=B-i\n if x<0:\n break\n tmp=int(A*x/B)-A*int(x/B)\n ans=max(ans,tmp)\n #print(ans)', 'A,B,N=map(int,input().split())\nans=0\nif B>=N:\n for i in range(0,10**6):\n x=N-i+100\n if x<0:\n break\n tmp=int(A*x/B)-A*int(x/B)\n ans=max(ans,tmp)\n print(ans)\nelif B<N:\n for i in range(0,10**6):\n x=N+100-i\n if x<0:\n break\n tmp=int(A*x/B)-A*int(x/B)\n ans=max(ans,tmp)\n for i in range(0,10**6):\n x=B+100-i\n if x<0:\n break\n tmp=int(A*x/B)-A*int(x/B)\n ans=max(ans,tmp)\n print(ans)', 'A,B,N=map(int,input().split())\nif B<=N:\n print(int(A*(B-1)/B)-A*int((B-1)/B))\nelse:\n print(int(A*(N)/B)-A*int(N/B))']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s369105784', 's510115698', 's021993772']
[9248.0, 9260.0, 9200.0]
[1555.0, 1733.0, 23.0]
[532, 505, 121]
p02696
u526094365
2,000
1,048,576
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.
['import math\n\nA, B, N = map(int, input().split())\n\n\nans1 = 0\n\nx = int(B/A)\nwhile x <= N and x <= B:\n ans = int((A * x) / B) - A * int(x / B)\n print(((A * x) / B), (x / B))\n ans1 = max(ans1, ans)\n x += 1\nprint(ans1)\n', 'import math\n\nA, B, N = map(int, input().split())\n\n\nans1 = 0\n\nif N > B - 1:\n x = B-1\n print(int((A * x) / B) - A * int(x / B))\nelif N <= B - 1:\n x = N\n print(int((A * x) / B) - A * int(x / B))\n\n\n']
['Wrong Answer', 'Accepted']
['s667971019', 's238800241']
[38196.0, 9164.0]
[2491.0, 22.0]
[226, 206]
p02696
u531219227
2,000
1,048,576
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.
['A,B,N = map(int,input().split())\nmax_num = 0\nnum = 0\nfor i in range(1,N+1):\n if (A*i//B) - A*(i//B) > max_num:\n max_num = (A*i//B) - A*(i//B)\n num = i\n \nprint(i)', 'A,B,N = map(int,input().split())\nnum = min(B-1,N)\n\nprint((A*num//B)-A*(num//B))']
['Wrong Answer', 'Accepted']
['s690643868', 's668523462']
[9176.0, 9160.0]
[2206.0, 24.0]
[171, 79]
p02696
u531220228
2,000
1,048,576
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.
['solved_flag = False\nif B==1:\n ans = 0\n solved_flag = True\nelse:\n if B <= N:\n x = B-1\n else:\n x = N\n\nif not solved_flag:\n ans = math.floor(A*x/B) - A*math.floor(x/B)\nprint(ans)', 'import math\n\nA, B, N = map(int, input().split())\n\nsolved_flag = False\nif B==1:\n ans = 0\n solved_flag = True\nelse:\n if B <= N:\n x = B-1\n else:\n x = N\n\nif not solved_flag:\n ans = math.floor(A*x/B) - A*math.floor(x/B)\nprint(ans)']
['Runtime Error', 'Accepted']
['s458475035', 's822200469']
[9108.0, 9068.0]
[22.0, 24.0]
[204, 254]
p02696
u534308356
2,000
1,048,576
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.
['A, B, N = map(int, input().split())\n\nans = 0\nfor x in range(B):\n A_x = A * x\n left_ = int(A_x / B)\n right_ = A * int(x / B)\n fnc_ = left_ - right_\n if fnc_ <= N:\n ans = max(ans, fnc_)\n \n\n # print(" x", x)\n \n # print("right_", right_)\n \n\n\nprint(ans)\n\n', 'A, B, N = map(int, input().split())\n\nans = 0\n\nx = min(N, B-1)\n\nA_x = A * x\nans = int(A_x / B) - A * int(x / B)\n\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s127789621', 's366003472']
[8972.0, 8940.0]
[2205.0, 21.0]
[360, 123]
p02696
u539514977
2,000
1,048,576
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.
['A,B,N = map(int,input().split())\nx = B-1\na = 0\nwhile x >= (B-1)*9/10:\n if a < A*x//B - A*(x//B):\n a = A*x//B - A*(x//B)\n x -= 1\n else:\n x -= 1\nprint(a)\n', 'A,B,N = map(int,input().split())\nprint(min(N, B-1))\n', 'A,B,N = map(int,input().split())\nx = 0\na = 0\nwhile x <= B-1:\n if a < A*x//B - A*(x//B):\n a = A*x//B - A*(x//B)\n x += 1\n else:\n x += 1\nprint(a)\n', 'A,B,N = map(int,input().split())\nx = min(N, B-1)\na = A*x//B - A*(x//B)\nprint(a)\n']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s695096710', 's770524564', 's981660899', 's458745732']
[9172.0, 9012.0, 9164.0, 9032.0]
[2205.0, 20.0, 2205.0, 22.0]
[163, 52, 154, 80]
p02696
u540761833
2,000
1,048,576
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.
['A,B,N = map(int,input().split())\nans = max((A*N)//B-A*(N//B),(A*(B-1))//B)\nprint(ans)', 'A,B,N = map(int,input().split())\nif N >= B-1:\n ans = max((A*N)//B-A*(N//B),(A*(B-1))//B)\nelse:\n ans = A*N//B - A*(N//B)\nprint(ans)']
['Wrong Answer', 'Accepted']
['s413757292', 's070618956']
[9168.0, 8936.0]
[23.0, 20.0]
[85, 136]
p02696
u542605091
2,000
1,048,576
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.
['n, m = map(int, input().split())\ncount = 0\nif n % 2 == 0:\n for i in range(int(n/2)):\n print(i+1, n-i-1)\n count += 1\n if count == m:\n break;\nelse:\n for i in range(int((n-1)/2)):\n print(i+1, n-i-2)\n count += 1\n if count == m:\n break;', 'a, b, n = map(int, input().split())\nif n < b:\n print(a*n//b)\nelse:\n print((a*(b-1))//b)']
['Runtime Error', 'Accepted']
['s788345603', 's607984516']
[9200.0, 9108.0]
[25.0, 20.0]
[301, 93]
p02696
u545368057
2,000
1,048,576
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.
['a,b,n = map(int, input().split())\n\ndef f(x):\n return (a*(x%b)-(a*b)%b)//b\n\nans = f(min(n,b-1))', 'a,b,n = map(int, input().split())\n"""\nfloor(ax/b) - a*floor(x/b)\n= (ax-(ax)%b)/b - a*(x-x%b)/b\n= (a*(x%b)-(ax)%b)/b\n"""\ndef f(x):\n return (a*(x%b)-(a*b)%b)//b\n\nans = f(min(n,b-1))\nprint(ans)']
['Wrong Answer', 'Accepted']
['s597091734', 's031306772']
[9156.0, 9084.0]
[21.0, 25.0]
[97, 193]
p02696
u546338822
2,000
1,048,576
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.
['def main():\n a,b,n = map(int,input().split())\n if b>n:\n print(int(a*(n/b-n//b)))\n else:\n print(int(a*((b-1)/b))\n\n\nif __name__ == "__main__":\n main()', 'def main():\n a,b,n = map(int,input().split())\n if b>n:\n print(int(a*(n/b-n//b)))\n else:\n print(int(a*((b-1)/b)))\n\n\nif __name__ == "__main__":\n main()']
['Runtime Error', 'Accepted']
['s359889729', 's272033856']
[9032.0, 9180.0]
[20.0, 22.0]
[174, 175]
p02696
u546618578
2,000
1,048,576
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.
["import math\n\na, b, n = map(int, input().split())\n\nif n < b:\n print('a')\n ans = math.floor(a*n/b) - a * math.floor(n/b)\n print(ans)\nelse:\n ans = a - a // b - 1\n print(ans)", "import math\n\na, b, n = map(int, input().split())\n\nif n < b:\n print('a')\n ans = math.floor(a*n/b) - a * math.floor(n/b)\n print(ans)\nelse:\n ans = a - (a-1) // b - 1\n print(ans)", 'import math\n\na, b, n = map(int, input().split())\n\nif n < b:\n ans = math.floor(a*n/b) - a * math.floor(n/b)\n print(ans)\nelse:\n ans = a - (a-1) // b - 1\n print(ans)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s907881095', 's931699632', 's622216118']
[9180.0, 9120.0, 9172.0]
[21.0, 22.0, 23.0]
[185, 189, 174]
p02696
u548123110
2,000
1,048,576
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.
['import math\n\n\ndef main():\n a,b,n = map(int,input().split())\n m = math.floor(a * 0 /b) - a * math.floor(0/b)\n for i in range(1,b):\n if m < math.floor(a * i / b) - a * math.floor(i/b):\n\n m = math.floor(a * i / b) - a * math.floor(i/b)\n print(m)\nif __name__ == "__main__":\n main()\n', 'import math\n\n\ndef main():\n a,b,n = map(int,input().split())\n m = math.floor(a * 0 /b) - a * math.floor(0/b)\n for i in range(1,min(b-1,n)+1):\n if m < math.floor(a * i / b) - a * math.floor(i/b):\n m = math.floor(a * i / b) - a * math.floor(i/b)\n break\n print(m)\nif __name__ == "__main__":\n main()\n', 'import math\n\n\ndef main():\n a,b,n = map(int,input().split())\n # m = math.floor(a * 0 /b) - a * math.floor(0/b)\n \n \n \n i = min(b-1,n)\n m = a*i//b - a*(i//b)\n \n print(m)\nif __name__ == "__main__":\n main()\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s132315911', 's590872907', 's323200926']
[9096.0, 9004.0, 9024.0]
[2205.0, 671.0, 22.0]
[311, 339, 379]
p02696
u551058317
2,000
1,048,576
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.
['A, B, N = [int(v) for v in input().strip().spilt(" ")]\n\nif N < B:\n\tprint(int(A * N * B) - A * int(N / B))\nelse:\n print(int(A * (B - 1) * B) - A * int((B - 1) / B))', 'A, B, N = [eval(v) for v in input().strip().split(" ")]\n\nif N < B:\n print(int(A * N / B) - A * int(N / B))\nelse:\n print(int(A * (B - 1) / B) - A * int((B - 1) / B))']
['Runtime Error', 'Accepted']
['s059148291', 's909951210']
[9048.0, 9100.0]
[25.0, 23.0]
[166, 170]
p02696
u552741877
2,000
1,048,576
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.
['import math\na,b,n = map(int, input().split())\n\ndef floor(t):\n return math.floor(t)\n\nx = b - 1\n\nmax = floor(a * x / b) - a * floor(x / b)\nprint(max)\n', 'import math\na,b,n = map(int, input().split())\n\ndef floor(t):\n return math.floor(t)\n\nx = b - 1\nif x > n:\n x = n\n\nmax = floor(a * x / b) - a * floor(x / b)\nprint(max)\n']
['Wrong Answer', 'Accepted']
['s649015383', 's395959021']
[9128.0, 9060.0]
[23.0, 21.0]
[149, 167]
p02696
u556589653
2,000
1,048,576
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.
['import math\ndef equation(a,b,n):\n return math.floor((a*x)/b)-A*math.floor(x/B)\nd,e,f = map(int,input().split())\nX = equation(d,e,f)\nY = equation(d,e,e-1)\nprint(max(X,Y))', 'A,B,N = map(int,input().split())\nx = math.gcd(N,B)\nK = math.floor(N/B)\nif K == 0:\n print(math.floor(A*N/B)-A*math.floor(N/B))\nelse:\n alpha = B*(K+1)-1\n if alpha > N:\n alpha = N\n print(math.floor(alpha/B)-A*math.floor(alpha/B))', 'import math\ndef equation(a,b,n):\n return math.floor((a*n)/b)-a*math.floor(n/b)\nd,e,f = map(int,input().split())\nK = min(e-1,f)\nprint(equation(d,e,K))\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s457620045', 's479569730', 's947357586']
[9132.0, 9052.0, 9088.0]
[20.0, 23.0, 22.0]
[170, 245, 151]
p02696
u560988566
2,000
1,048,576
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.
['import math\n\na, b, n = map(int, input().split())\n\nk = n//b\n\nans = math.floor(a*(k*b-1)/b) - a*(k-1)\n\nprint(ans)', 'import math\n\na, b, n = map(int, input().split())\n\nans = math.floor(a*min(b-1, n)/b)\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s628705422', 's063108095']
[9024.0, 9092.0]
[27.0, 24.0]
[111, 95]
p02696
u561862393
2,000
1,048,576
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.
['import sys\ninput = sys.stdin.readline\nimport numpy as np\nimport time\n\n\n\n\n\ndef make_table(n, m):\n Table = [None]*n\n for i in range(n):\n rem = np.random.randint(1,m+1)\n Table[i] = rem\n return Table\n\nt0 = time.time()\nn, m, q = map(int, input().split())\nLis = [[int(e) for e in input().split()] for _ in range(q)]\n\nSum_cor = []\nfor i in range(10000000000):\n if m >=6:\n Table = make_table(n,m)\n else:\n Table = make_table(n,m)\n Table.sort()\n d_sum = 0\n for l in Lis:\n if Table[l[1]-1]-Table[l[0]-1] == l[2]:\n d_sum+=l[3]\n Sum_cor.append(d_sum)\n t1 = time.time()\n if t1-t0 >1.8:\n print(max(Sum_cor))\n break\n', 'import sys\ninput = sys.stdin.readline\n\n\na, b, c= map(int, input().split())\n\n\n#f_table = [a*t//b for t in range(b)]\n\nif c >= b:\n print((a * (b-1)) // b)\n\nelse:\n x = c\n c_amari = c%b\n c_sho = c//b\n ans =(a * c_amari) //b\n print(ans)\n']
['Runtime Error', 'Accepted']
['s126150975', 's219313692']
[99168.0, 9168.0]
[2209.0, 21.0]
[887, 249]
p02696
u563676207
2,000
1,048,576
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.
['# input\nA, B, N = map(int, input().split())\n\n# process\nx = 0\nif B <= N:\n x = B-1\nelse:\n x = N\n\n# output\nprint(x)\nprint(A*x//B - A*(x//B))\n', '# input\nA, B, N = map(int, input().split())\n\n# process\nx = 0\nif B <= N:\n x = B-1\nelse:\n x = N\n\n# output\nprint(A*x//B - A*(x//B))\n']
['Wrong Answer', 'Accepted']
['s860573062', 's786746050']
[9040.0, 9160.0]
[22.0, 22.0]
[144, 135]
p02696
u563838154
2,000
1,048,576
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.
['a,b,n=map(int,input().split())\nscore=0\nif (n<b):\n print( int(a*n/b))\nelif(b==1):\n print(0)\nelse:\n c = int(n/b)\n score = 0\n for i in range(1,c+1):\n n_ = b*i-1\n t = int(a*n_/b)-a*int(n_/b)\n score = max(score,t)\n t = int(a*n/b)-a*int(n/b)\n score = max(score,t)\n print(score)', 'a,b,n=map(int,input().split())\nscore=0\nif (n<b):\n print( int(a*n/b))\nelif(b==1):\n print(0)\nelse:\n c = int(n/b)\n score = 0\n for i in range(1,c+1):\n n_ = b*i-1\n t = int(a*n_/b)-a*int(n_/b)\n score = max(score,t)\n t = int(a*n/b)-a*int(n/b)\n score = max(score,t)\n print(score)']
['Runtime Error', 'Accepted']
['s011244631', 's304916693']
[8928.0, 9144.0]
[24.0, 22.0]
[322, 316]
p02696
u571537830
2,000
1,048,576
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.
['a, b, n = map(int, input().split())\n\nx = max(b-1, n)\n\nprint((a*x)//b)', 'a, b, n = map(int, input().split())\n\nx = min(b-1, n)\n\nprint((a*x)//b)']
['Wrong Answer', 'Accepted']
['s828932248', 's616340621']
[9024.0, 9092.0]
[26.0, 29.0]
[69, 69]
p02696
u573234244
2,000
1,048,576
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.
['a,b,n = map(int,input().split())\n\nif b >= n:\n t = int(a * n / b) - a * int(n/b)\n for i in range(100000):\n t_ = int(a * (n+i) / b) - a * int((n+i)/b)\n if t_ > t:\n t = t_\nelse:\n t = int(a * n / b) - a * int(n/b)\n \nprint(t)', 'a,b,n = map(int,input().split())\n\nif b > n:\n t = int(a * n / b) - a * int(n/b)\nelse:\n x = b-1\n t = int(a * x / b) - a * int(x/b)\n \nprint(t)']
['Wrong Answer', 'Accepted']
['s011453709', 's080606808']
[9184.0, 9168.0]
[86.0, 21.0]
[257, 151]
p02696
u573673983
2,000
1,048,576
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.
['A,B,N = (int(i) for i in input().split())\nmax_num = -10**100\ntmp_num = 0\ncnt = 1\nflg = False\nwhile flg == False:\n tmp_num = math.floor(A*cnt/B) - A*math.floor(cnt/B)\n #print(tmp_num)\n if tmp_num > max_num :\n max_num = tmp_num\n cnt += 1\n else:\n flg = True\nprint(max_num)', 'a, b, n = map(int, input().split())\nif n >= b - 1:\n print(int(a - a / b))\nelse:\n print(int(a * n / b) - a * int(n / b))']
['Runtime Error', 'Accepted']
['s353531308', 's132095213']
[9032.0, 9052.0]
[21.0, 22.0]
[283, 125]
p02696
u573678402
2,000
1,048,576
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.
['a, b, n = map(int, input().split(" "))\n\nmax_score = 0\ny = a // b\nfor x in range(y - 100, y + 200):\n score = a * x // b - a * ( x // b )\n if score > max_score:\n max_score = score\nprint(max_score)\n', 'a, b, n = map(int, input().split(" "))\n\nmax_score = 0\ny = min(b, n)\n\nfor x in range(max(y - 100000, 1) , min(y + 200000, n+1)):\n score = a * x // b - a * ( x // b )\n if score > max_score:\n max_score = score\nprint(max_score)\n']
['Wrong Answer', 'Accepted']
['s642749970', 's391850206']
[9164.0, 9180.0]
[24.0, 131.0]
[208, 237]
p02696
u576927476
2,000
1,048,576
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.
['import sys\n\n\na,b,n = (int(i) for i in input().split())\n\n\nans = b-1\n\n\n\nprint(ans)\n', 'import sys\n\n\na,b,n = (int(i) for i in input().split())\n\n\nif n < b-1:\n ans = (a*n//b)\n\nelse:\n ans = ((b-1)*a)//b\n\n\n\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s350807598', 's025593002']
[9152.0, 9156.0]
[19.0, 20.0]
[81, 132]
p02696
u577766140
2,000
1,048,576
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.
['list=input().split(" ")\nA=int(list[0])\nB=int(list[1])\nN=int(list[2])\n\nif B>N:\n B=N-1\n\nprint(int(A*B/N) - int(B/N)*A)', 'list=input().split(" ")\nA=int(list[0])\nB=int(list[1])\nN=int(list[2])\n\nif N>=B:\n N=B-1\n\nprint(int(A*N/B) - int(N/B)*A)']
['Wrong Answer', 'Accepted']
['s710915644', 's626429892']
[9124.0, 9152.0]
[21.0, 21.0]
[119, 120]
p02696
u580273604
2,000
1,048,576
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.
['A,B,N=map(int,input().split())\n\n#c=[0]*N\ns=0\nprint(max(N,(A*N)//B-A*(N//B)))\n\nexit\nfor i in range(1,N+1):\n if s<(A*i)//B-A*(i//B):\n s=(A*i)//B-A*(i//B)\n\nprint(s)', 'A,B,N=map(int,input().split())\n#if B==1:print(0);exit()\nif N>=B:print((A*(B-1))//B)\nelse:\n print((A*N)//B-A*(N//B))']
['Wrong Answer', 'Accepted']
['s665695758', 's985780469']
[9128.0, 9108.0]
[2205.0, 26.0]
[188, 116]
p02696
u581187895
2,000
1,048,576
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.
['\ndef resolve():\n def f(x):\n res = (A*x)//B - A*(x//B)\n return res\n\n A, B, N = map(int, input().split())\n x = min(B-1, N)\n print(f(x))\n\nif __name__ == "__main__":\n resolve():', '\ndef resolve():\n def f(x):\n res = (A*x)//B - A*(x//B)\n return res\n\n A, B, N = map(int, input().split())\n x = min(B-1, N)\n print(f(x))\n\nif __name__ == "__main__":\n resolve()']
['Runtime Error', 'Accepted']
['s613527991', 's975297772']
[8924.0, 9080.0]
[20.0, 23.0]
[202, 201]
p02696
u590212853
2,000
1,048,576
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.
['#!/usr/bin/python3\n\nimport math\n\ninput_1 = input()\na = int(input_1.split(" ")[0])\nb = int(input_1.split(" ")[1])\nn = int(input_1.split(" ")[2])\n\n\n\nscore = math.floor(a/b*math.min(b-1, n))\nprint(score)', '#!/usr/bin/python3\n\nimport math\n\ninput_1 = input()\na = int(input_1.split(" ")[0])\nb = int(input_1.split(" ")[1])\nn = int(input_1.split(" ")[2])\n\n\n\nscore = math.floor(a/b*min(b-1, n))\nprint(score)']
['Runtime Error', 'Accepted']
['s962538887', 's356556005']
[9024.0, 9152.0]
[20.0, 24.0]
[253, 248]
p02696
u591143370
2,000
1,048,576
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.
['import math\nA,B,N = map(int, input().split())\ns=0\nx=1\nmf=math.floor\nwhile True:\n q=mf(A*x/B)-A*mf(x/B)\n if s<=q:\n s=q\n #print(q)\n x=x+1\n continue\n if s>q:\n print(s)\n break', 'import math\nA,B,N = map(int, input().split())\ns=0\nx=1\nmf=math.floor\nwhile True:\n q=mf(A*x/B)-A*mf(x/B)\n if s<=q:\n s=q\n print(q)\n x=x+1\n continue\n if s>q:\n print(s)\n break\n', 'import math\nA,B,N = map(int, input().split())\n\nmf=math.floor\nif N<B-1:\n q=mf(A*N/B)-A*mf(N/B)\n print(q)\nelse:\n a=math.floor(A*(B-1)/B)\n print(a)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s234953278', 's667190919', 's428342309']
[9168.0, 9852.0, 9184.0]
[2205.0, 2217.0, 21.0]
[222, 222, 156]
p02696
u593019570
2,000
1,048,576
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.
['import math\na,b,n = map(int,input().split())\nans = max(math.floor(a * (b-1) / b) - a * math.floor((b-1) / b), math.floor(a * n / b) - a * math.floor(n / b))\n \nprint(ans)', 'import math\na,b,n = map(int,input().split())\nc = n // b * b - 1\nans = max(math.floor(a * c / b) - a * math.floor(c / b), math.floor(a * n / b) - a * math.floor(n / b))\n\nprint(ans)', 'a,b,n = map(int,input().split())\nc = n // b * b\nans=0\nif n > b - 1:\n ans = math.floor(a * c / b) - a * math.floor(c / b)\n\nelse:\n \n #print(i+1)\n #print(math.floor(a * (i+1) / b) - a * math.floor((i+1) / b))\n #if math.floor(a * (i+1) / b) - a * math.floor((i+1) / b) > ans:\n # ans = math.floor(a * (i+1) / b) - a * math.floor((i+1) / b)\n ans = math.floor(a * n / b) - a * math.floor(n / b)\nprint(ans)\n ', 'import math\na,b,n = map(int,input().split())\nc = max(0,n // b * b - 1)\nans = math.floor(a * c / b) - a * math.floor(c / b)\n \nprint(ans)\n', 'import math\na,b,n = map(int,input().split())\nc = n // b * b - 1\nans = max(math.floor(a * c / b) - a * math.floor(c / b), math.floor(a * n / b) - a * math.floor(n / b), 0)\n \nprint(ans)', 'import math\na,b,n = map(int,input().split())\nc = max(0,n // b * b - 1)\nans = mmath.floor(a * n / b) - a * math.floor(n / b)\n \nprint(ans)\n', 'print(0)', 'import math\na,b,n = map(int,input().split())\nc = max(0,n // b * b - 1)\nans = mmath.floor(a * c / b) - a * math.floor(c / b)\n \nprint(ans)', 'import math\na,b,n = map(int,input().split())\nc = min(n,b - 1)\nans = math.floor(a * c / b) - a * math.floor(c / b)\n \nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s076121793', 's091224647', 's098045196', 's572116580', 's704613913', 's874037954', 's894000046', 's944735844', 's556369065']
[9148.0, 9164.0, 9148.0, 9128.0, 9156.0, 9108.0, 9020.0, 9200.0, 9164.0]
[23.0, 24.0, 21.0, 23.0, 21.0, 20.0, 21.0, 20.0, 20.0]
[169, 179, 462, 136, 183, 137, 8, 136, 126]
p02696
u594956556
2,000
1,048,576
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.
['A, B, N = map(int, input().split())\nprint(min(B-1, N))', 'A, B, N = map(int, input().split())\nprint(A*min(B-1, N)//B)\n']
['Wrong Answer', 'Accepted']
['s373501606', 's140596686']
[9152.0, 9092.0]
[21.0, 25.0]
[54, 60]
p02696
u595893956
2,000
1,048,576
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.
['a,b,n = map(int,input().split())\nprint(min(n,b-1)/b*a)', 'a,b,n = map(int,input().split())\nprint(min(n,b-1)*a//b)\n']
['Wrong Answer', 'Accepted']
['s547721590', 's681522934']
[9100.0, 9132.0]
[21.0, 23.0]
[54, 56]
p02696
u602773379
2,000
1,048,576
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.
['from math import factorial as fact\nimport math\nimport sys\nimport itertools\nimport numpy as np\nfrom collections import Counter\nimport datetime\n\n\n\ndef input1():\n\treturn int(input())\n\n\ndef input2():\n\treturn map(int,input().split())\n\n\ndef input_array():\n\treturn list(map(int,input().split()))\n\ndef keta(N):\n\treturn len(str(N))\n\n\ndef input_daytime(input_time):\n\ttime,distance=input_time.split()\n\tt=time.split(":")\n\tse=str(t[-1]).split(".")\n\tdt1 = datetime.timedelta(hours=int(t[0]),minutes=int(t[1]),seconds=int(se[0]),milliseconds=int(se[1]))\n\treturn dt1\n\ndef combinations(n,r):\n\treturn list(itertools.combinations(range(n),r))\n\n\n\ndef all_sets(num_list):\n\tsubsets=[]\n\tfor i in range(2,len(num_list) + 1):\n\t\tfor c in combinations(num_list, i):\n\t\t\tsubsets.append(c) \n\treturn subsets\n\n\ndef ch(x1):\n\tcf=[]\n\tfor i in range(2,math.sqrt(x1)+1):\n\t\tif x1 % i==0:\n\t\t\tcf.append(i)\n\treturn cf\n\ndef CountOneRoots(x,y):\n\t\n\treturn fact(x+y)/fact(x)/fact(y)\n\n\ndef factorization(n):\n\ttmp=n\n\tcount=0\n\tfor i in range(2,int(n**0.5)+2):\n\t\tif tmp%i==0:\n\t\t\tcnt=0\n\t\t\twhile tmp%i==0:\n\t\t\t\tcnt+=1\n\t\t\t\ttmp//=i\n\t\t\tcount+=1\n\tif tmp!=1:\n\t\tcount+=1\n\n\treturn count\n\t\t\t\n\ndef fl(a,b,x):\n\tx=math.floor(a*x/b)\n\ty=a*math.floor(x/b)\n\t\n\n\n\n# abcd=[]\n# A=[0]*n\n\n# \tabcd.append(input_array())\n\na,b,n=input2()\nif b>n:\n\tb_ans=fl(a,b,n)\nelse:\n\tb_ans=fl(a,b,b-1)\n\n\n# \tans=fl(a,b,i)\n# \tif ans> b_ans:\n# \t\tb_ans=ans\n# if i<n:\n# \tans=fl(a,b,n)\n# \tif ans> b_ans:\n# \t\tb_ans=ans\nprint(b_ans)\n\n', 'from math import factorial as fact\nimport math\nimport sys\nimport itertools\nimport numpy as np\nfrom collections import Counter\nimport datetime\n\n\n\ndef input1():\n\treturn int(input())\n\n\ndef input2():\n\treturn map(int,input().split())\n\n\ndef input_array():\n\treturn list(map(int,input().split()))\n\ndef keta(N):\n\treturn len(str(N))\n\n\ndef input_daytime(input_time):\n\ttime,distance=input_time.split()\n\tt=time.split(":")\n\tse=str(t[-1]).split(".")\n\tdt1 = datetime.timedelta(hours=int(t[0]),minutes=int(t[1]),seconds=int(se[0]),milliseconds=int(se[1]))\n\treturn dt1\n\ndef combinations(n,r):\n\treturn list(itertools.combinations(range(n),r))\n\n\n\ndef all_sets(num_list):\n\tsubsets=[]\n\tfor i in range(2,len(num_list) + 1):\n\t\tfor c in combinations(num_list, i):\n\t\t\tsubsets.append(c) \n\treturn subsets\n\n\ndef ch(x1):\n\tcf=[]\n\tfor i in range(2,math.sqrt(x1)+1):\n\t\tif x1 % i==0:\n\t\t\tcf.append(i)\n\treturn cf\n\ndef CountOneRoots(x,y):\n\t\n\treturn fact(x+y)/fact(x)/fact(y)\n\n\ndef factorization(n):\n\ttmp=n\n\tcount=0\n\tfor i in range(2,int(n**0.5)+2):\n\t\tif tmp%i==0:\n\t\t\tcnt=0\n\t\t\twhile tmp%i==0:\n\t\t\t\tcnt+=1\n\t\t\t\ttmp//=i\n\t\t\tcount+=1\n\tif tmp!=1:\n\t\tcount+=1\n\n\treturn count\n\t\t\t\n\ndef fl(a,b,x):\n\tb1=x//b\n\tx=math.floor(a*x/b)\n\ty=math.floor(b1)\n\treturn x-y\n\t\n\n\n\n# abcd=[]\n# A=[0]*n\n\n# \tabcd.append(input_array())\n\na,b,n=input2()\nif b>n:\n\tb_ans=fl(a,b,n)\n\t# print(b_ans)\nelse:\n\tb_ans=fl(a,b,b-1)\n\nfor i in range(0,n,b):\n\tans=fl(a,b,i)\n\t# print(ans)\n\tif ans> b_ans:\n\t\tb_ans=ans\n\telse:\n\t\tbreak\n# if i<n:\n# \tans=fl(a,b,n)\n# \tif ans> b_ans:\n# \t\tb_ans=ans\nprint(b_ans)\n\n']
['Wrong Answer', 'Accepted']
['s739111767', 's775424746']
[27156.0, 26924.0]
[104.0, 107.0]
[1631, 1686]
p02696
u607563136
2,000
1,048,576
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.
['a,b,n = map(int,input().split())\n\ny = 0\n\nfor x in range(1,n+1):\n if x%b!=0:\n temp = ((a*x)//b) - a*(x//b)\n else:\n temp = 0\n if y < temp:\n y = temp\n ans = x\n \nprint(ans)', 'a,b,n = map(int,input().split())\nx=min(b-1,n)\nprint(((a*x)//b) - a*(x//b))']
['Runtime Error', 'Accepted']
['s188611434', 's862401446']
[9180.0, 9152.0]
[2205.0, 31.0]
[208, 74]
p02696
u608007704
2,000
1,048,576
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.
['A,B,N=map(int,input().split())\n\nans=0\nfor x in range(A*3):\n \n ans=max(ans,A*x//B-A*(x//B))\nprint(ans)', 'A,B,N=map(int,input().split())\n\nans=-100000\nfor x in range(A):\n \n ans=max(ans,(A*x//B)-A*(x//B))\n if x==N:break\nx=B-1\nif x>N:x=N\nans=max(ans,(A*x//B)-A*(x//B))\nprint(ans)']
['Wrong Answer', 'Accepted']
['s472092750', 's755225465']
[9040.0, 9064.0]
[1084.0, 415.0]
[143, 213]
p02696
u608355135
2,000
1,048,576
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.
['import math\na,b,n=map(int,input().split())\nmax=0\npre=0\nif b//a==0:\n st=1\nelse:\n st=b//a\ncheck=0\nfor i in range(0,n+1,st):\n f=math.floor(a*i/b)-a*math.floor(i/b)\n if f>=max:\n max=f\n if f==0:\n check+=1\n if check>st:\n break\n\nprint(max)\n', 'import math\na,b,n=map(int,input().split())\nmax=0\npre=0\nif b//a-1<=0:\n st=1\nelse:\n st=b//a-1\ncheck=0\nfor i in range(0,n+1,st):\n f=math.floor(a*i/b)-a*math.floor(i/b)\n if f>max:\n max=f\n if f==0:\n check+=1\n if check>st+2:\n break\nprint(max)']
['Wrong Answer', 'Accepted']
['s312816562', 's475352377']
[9192.0, 9192.0]
[693.0, 691.0]
[272, 275]
p02696
u609307781
2,000
1,048,576
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.
["# D\n\ninp = input().split(' ')\nA, B, N = int(inp[0]), int(inp[1]), int(inp[2])\n\nalpha, beta = math.floor(A/B), A%B\nif B-1 < N:\n x = B-1\nelse:\n x = N\n \nprint(math.floor(A*x/B) - A * math.floor(x/B))", "# D\n\nimport math\ninp = input().split(' ')\nA, B, N = int(inp[0]), int(inp[1]), int(inp[2])\n\nalpha, beta = math.floor(A/B), A%B\nif B-1 < N:\n x = B-1\nelse:\n x = N\n \nprint(math.floor(A*x/B) - A * math.floor(x/B))"]
['Runtime Error', 'Accepted']
['s293438888', 's757925601']
[9188.0, 9188.0]
[24.0, 24.0]
[205, 217]
p02696
u612261372
2,000
1,048,576
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.
['from math import floor\nA, B, N = map(int,input().split())\n\nx=0\npre=floor(A*x/B)-A*floor(x/B)\nmax_x=0\nmax_i=pre\n\nwhile True:\n\tx +=1\n\tcur=floor(A*x/B)-A*floor(x/B)\n\t\n\tif (cur < pre)and(x<=N):\n\t\tprint(x-1)\n\t\tbreak\n\telif(x>N):\n\t\tprint(max_x)\n\t\tbreak\n\telse:\n\t\tif max_i < cur:\n\t\t\tmax_i = cur\n\t\t\tmax_x = x\n\t\tpre = cur', 'from math import floor\nA, B, N = map(int,input().split())\n\nx=max(N,B-1)\nprint(floor(A*x/B)-A*floor(x/B))', 'from math import floor\nA, B, N = map(int,input().split())\n\nx=min(N,B-1)\nprint(floor(A*x/B)-A*floor(x/B))']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s516467252', 's685178961', 's791257383']
[9096.0, 9164.0, 9096.0]
[2205.0, 22.0, 22.0]
[326, 104, 104]
p02696
u616468898
2,000
1,048,576
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.
['import math\nA, B, N = list(map(int, input().split()))\nminx = min([B-1, N])\nprint(math.floor(A*minx/B) - A*math.floor(minx*B))', 'import math\nA, B, N = list(map(int, input().split()))\nminx = min([B-1, N])\nprint(math.floor(A*minx/B) - A*math.floor(minx/B))']
['Wrong Answer', 'Accepted']
['s056793911', 's546899826']
[9084.0, 9140.0]
[21.0, 22.0]
[125, 125]
p02696
u617037231
2,000
1,048,576
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.
['import math\nfrom math import floor\nA,B,N = map(int,input().split())\nmaxi = 0\nNpower = 0\ndiff = 0\nS = N\nwhile S/10 >= 1:\n Npower += 1\n S /=10\nif Npower >= 8: \n for i in range(0,10**6+10**5):\n maxi = max(floor((A*i)/B)-A*floor(i/B),maxi)\n for i in range(N-10**6-10**5-10**4-10**3-10**2,N+1):\n maxi = max(floor((A*i)/B)-A*floor(i/B),maxi)\nelse:\n for i in range(0,N+1):\n maxi = max(floor((A*i)/B)-A*floor(i/B),maxi)\nprint(max(maxi-1,0))', 'import math\nfrom math import floor\nA,B,N = map(int,input().split())\nmaxi = 0\nNpower = 0\ndiff = 0\nS = N\nwhile S/10 >= 1:\n Npower += 1\n S /=10\nif Npower >= 7:\n for i in range(0,10**6+3*10**5):\n maxi = max(int((A*i)/B)-A*int(i/B),maxi)\n for i in range(N-10**6,N+1):\n maxi = max(int((A*i)/B)-A*int(i/B),maxi)\nelse:\n for i in range(0,N+2):\n maxi = max(int((A*i)/B)-A*int(i/B),maxi)\nprint(max(maxi,0))', 'import math\nA,B,N = mips()\nK = N-1\nprint(max(math.floor(A*N/B)-A*math.floor(N/B),math.floor(A*K/B)-A*math.floor(K/B),0))', 'import math\nA,B,N = map(int,input().split())\nmaxi = -100000\nNpower = 0\ndiff = 0\nwhile N > 1:\n N /=10\n Npower += 1\nif Npower >= 6:\n diff = N-1000\nfor i in range(diff,N+1):\n maxi = max(math.floor(A*i/B)-A*math.floor(i/B),maxi,0)\nprint(maxi)\n', 'import math\nfrom math import floor\nA,B,N = map(int,input().split())\nmaxi = 0\nNpower = 0\ndiff = 0\nS = N\nwhile S/10 >= 1:\n Npower += 1\n S /=10\nif Npower >= 7:\n for i in range(0,10**6+10**5):\n maxi = max(int((A*i)/B)-A*int(i/B),maxi)\n for i in range(N-2*10**6,N+1):\n maxi = max(int((A*i)/B)-A*int(i/B),maxi)\nelse:\n for i in range(0,N+2):\n maxi = max(int((A*i)/B)-A*int(i/B),maxi)\nprint(max(maxi,0))\n', 'import math\nfrom math import floor\nA,B,N = map(int,input().split())\nmaxi = 0\nNpower = 0\ndiff = 0\nS = N\nwhile S/10 >= 1:\n Npower += 1\n S /=10\nif Npower >= 7:\n for i in range(0,10**6+10**5):\n maxi = max(int((A*i)/B)-A*int(i/B),maxi)\n for i in range(N-2*10**6,N+1):\n maxi = max(int((A*i)/B)-A*int(i/B),maxi)\nelse:\n for i in range(0,N+1):\n maxi = max(int((A*i)/B)-A*int(i/B),maxi)\nprint(0)', 'import math\nA,B,N = map(int,input().split())\nmaxi = -100000\nNpower = 0\ndiff = 0\nwhile N > 1:\n N /=10\n Npower += 1\nif Npower >= 6:\n diff = N-1000\nfor i in range(diff,N+1):\n maxi = max(math.floor(A*i/B)-A*math.floor(i/B),maxi,0)\nprint(maxi)', 'import math\nA,B,N = map(int,input().split())\nmaxi = -100000\nNpower = 0\nwhile N > 1:\n N /=10\n Npower += 1\nif Npower >= 6:\n diff = N-1000\nelse:\n diff = 0\nfor i in range(diff,N+1):\n maxi = max(math.floor(A*i/B)-A*math.floor(i/B),maxi,0)\nprint(maxi)', 'import math\nA,B,N = mips()\nmaxi = -100000\nfor i in range(0,N+1):\n maxi = max(math.floor(A*i/B)-A*math.floor(i/B),maxi)\nprint(maxi)', 'import math\nfrom math import floor\nA,B,N = map(int,input().split())\nmaxi = 0\nNpower = 0\ndiff = 0\nS = N\nwhile S/10 >= 1:\n Npower += 1\n S /=10\nif Npower >= 8: \n for i in range(0,10**6+10**5):\n maxi = max(floor((A*i)/B)-A*floor(i/B),maxi)\n for i in range(N-10**6-10**5-10**4-10**3-10**2,N+1):\n maxi = max(floor((A*i)/B)-A*floor(i/B),maxi)\nelse:\n for i in range(0,N+1):\n maxi = max(floor((A*i)/B)-A*floor(i/B),maxi)\nprint(max(maxi+1,0))\n', 'import math\nfrom math import floor\nA,B,N = map(int,input().split())\ndef f(x):\n return floor(A*x/B) - A*floor(x/B)\nprint(f(min(B-1,N)))']
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s208985769', 's244568270', 's312148177', 's379827456', 's490697277', 's692571798', 's830573494', 's941280985', 's955122771', 's984733905', 's935877298']
[9236.0, 9232.0, 9100.0, 9184.0, 9176.0, 9216.0, 9192.0, 9224.0, 9104.0, 9228.0, 9040.0]
[1253.0, 1407.0, 20.0, 21.0, 2089.0, 2015.0, 22.0, 22.0, 23.0, 1265.0, 21.0]
[468, 431, 120, 249, 432, 421, 248, 256, 133, 469, 135]
p02696
u620157187
2,000
1,048,576
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.
['A, B, N = map(int, input().split())\nif N >= B-1:\n result = B-1\nelse:\n result = N\n \nprint(result)', 'A, B, N = map(int, input().split())\nif N >= B-1:\n result = B-1\nelse:\n result = N\n \nprint(min(B-1, N))', 'A, B, N = map(int, input().split())\nif B == 1:\n result = 0\nelif N >= B-1:\n result = B-1\nelse:\n result = N\n \nprint(result)', 'A, B, N = map(int, input().split())\nif B == 1:\n result = 0\nelif B-1 >= N:\n result = min(A, B)-1\nelse:\n result = int(A*N/B) - A*int(N/B)\n \nprint(result)', 'A, B, N = map(int, input().split())\nif B == 1:\n result = 0\nelif N >= B - 1:\n result = int(A*(B-1)/B) - A*int((B-1)/B)\nelse:\n result = int(A*N/B) - A*int(N/B)\n \nprint(result)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s033160751', 's529721186', 's644217479', 's810412800', 's487747393']
[9044.0, 9100.0, 9172.0, 9176.0, 9116.0]
[23.0, 18.0, 19.0, 22.0, 20.0]
[105, 110, 133, 163, 185]
p02696
u620238824
2,000
1,048,576
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.
['a, b, n = map(int, input().split())\n\nc = min(b - 1, n)\n\n\nprint(((a * c) / b) // 1 - (a * ((c / b) // 1)))', 'a, b, n = map(int, input().split())\n\nc = min(b - 1, n)\n\nprint(int(((a * c) / b) // 1 - (a * ((c / b) // 1))))']
['Wrong Answer', 'Accepted']
['s775271680', 's193965158']
[9160.0, 9012.0]
[27.0, 26.0]
[122, 126]
p02696
u622847899
2,000
1,048,576
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.
['import math\n\nA,B,N=map(int,input().split())\n\nmax = 0\nfor i in range(B):\n value = math.floor(A*i/B) - A*math.floor(i/B)\n if value > max:\n max=value\nprint(max)\n', 'import math\n\nA,B,N=map(int,input().split())\n\ndef f(x):\n return math.floor(A*x/B) - A*math.floor(x/B)\nprint(f(min(N,B-1)))\n']
['Wrong Answer', 'Accepted']
['s286913587', 's468975883']
[9036.0, 9076.0]
[2205.0, 20.0]
[171, 125]
p02696
u626228246
2,000
1,048,576
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.
['a,b,n = map(int,input().split())\n#if b%n != 0:\n\t#print((a*n)//b - ((n//b)*a))\n#else:\nn = b-1\nprint((a*n)//b - ((n//b)*a))\n\t', 'a,b,n = map(int,input().split())\nif b <= n:\n\tprint(a)\n#else:\n\t#print((a*n)//b - ((n//b)*a))', 'a,b,n = map(int,input().split())\nl = (a*n)//b - ((n//b)*a)\nn = b-1\nm = (a*n)//b - ((n//b)*a)\nprint(max(l,m))\n\t', 'a,b,n = map(int,input().split())\nif n >= b:\n\tn = b-1\n\tprint((a*n)//b - ((n//b)*a))\nelse:\n\tprint((a*n)//b - ((n//b)*a))\n\t']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s142721375', 's327161590', 's998520133', 's378147139']
[9136.0, 9172.0, 9100.0, 9108.0]
[26.0, 29.0, 26.0, 26.0]
[123, 91, 110, 120]
p02696
u626529075
2,000
1,048,576
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.
['import math\n\na, b, n = (int(x) for x in input().split())\n\nif b > n:\n print(math.floor(b * n / b) - a * math.floor(n / b))\nelse:\n print(math.floor(a * (b -1) / b) - a * math.floor((b -1) / b))', 'import math\n\na, b, n = (int(x) for x in input().split())\n\nif b > n:\n print(math.floor(a * n / b) - a * math.floor(n / b))\nelse:\n print(math.floor(a * (b -1) / b) - a * math.floor((b -1) / b))']
['Wrong Answer', 'Accepted']
['s588271794', 's991400472']
[9176.0, 9120.0]
[22.0, 23.0]
[197, 197]
p02696
u627600101
2,000
1,048,576
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.
['A, B, N = map(int,input().split())\nimport math\n\nx1 = N\nx3 = min(N,B-1)\ndef f(x): \n t = math.floor((A*x)/B) - A * math.floor(x/B)\n return int(t)\nprint(max(f(x1),f(x3)))\nprint(max(3,3,2))', 'A, B, N = map(int,input().split())\nimport math\nx1 = N\nx2 = min(N,B-1)\ndef f(x): \n return A*x//B - A*(x//B)\nprint(max(f(x1),f(x2)))']
['Wrong Answer', 'Accepted']
['s985538474', 's595954735']
[9124.0, 9168.0]
[22.0, 20.0]
[191, 133]
p02696
u629350026
2,000
1,048,576
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.
['a,b,n = map(int, input().split())\nsumtemp=0\nsummax=0\nfor x in range(1,b):\n sumtemp=int(a*x/b)-a*int(x/b)\n if sumtemp>summax:\n summax=sumtemp\nprint(sumtemp)', 'a,b,n = map(int, input().split())\nsumtemp=0\nsummax=0\nfor x in range(1,n+1-b):\n sumtemp=int(a*x/b)-a*int(x/b)\n if sumtemp>summax:\n summax=sumtemp\nprint(sumtemp)', 'a,b,n=map(int,input().split())\nif n>=b:\n print(int(a*(b-1)/b))\nelse:\n print(int(a*n/b))']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s925921549', 's982539797', 's854382788']
[9056.0, 9176.0, 9164.0]
[2205.0, 2206.0, 20.0]
[168, 172, 89]
p02696
u629607744
2,000
1,048,576
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.
['def i():\n return int(input())\ndef i2():\n return map(int,input().split())\ndef s():\n return str(input())\ndef l():\n return list(input())\ndef intl():\n return list(int(k) for k in input().split())\n\na,b,n=i2()\nprint( a*(b-1)//b )', 'def i():\n return int(input())\ndef i2():\n return map(int,input().split())\ndef s():\n return str(input())\ndef l():\n return list(input())\ndef intl():\n return list(int(k) for k in input().split())\n\na,b,n=i2()\nif b<=n:\n\tprint( a*(b-1)//b )\nelse:\n\tprint( a*n//b )']
['Wrong Answer', 'Accepted']
['s466612210', 's976858610']
[9096.0, 9164.0]
[22.0, 24.0]
[238, 271]
p02696
u632609425
2,000
1,048,576
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.
['A,B,N=map(int,input().split())\nresult=0\nfor x in range(0,n+1):\n\ta=int(A*x/B)-A*int(x/B)\n\tif a>result:\n\t\tresult=a\nprint(result)', 'A,B,N=map(int,input().split())\nif B!=1:\n\tp=(N+1)//B\n\tresult=0\n\tif p!=0:\n\t\tfor a in range(1,p+1):\n\t\t\tx=a*B-1\n\t\t\ts=(A*x)//B - A*(a-1)\n\t\t\tif result < s:\n\t\t\t\tresult=s\n\telse:\n\t\tresult=A*N//B -A*(N//B)\n\tprint(result)\nelse:\n\tprint(0)']
['Runtime Error', 'Accepted']
['s302397716', 's086075196']
[9172.0, 9204.0]
[24.0, 24.0]
[126, 226]
p02696
u634079249
2,000
1,048,576
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.
['import sys\nimport os\nimport math\nimport bisect\nimport collections\nimport itertools\n\nii = lambda: int(sys.stdin.buffer.readline().rstrip())\nil = lambda: list(map(int, sys.stdin.buffer.readline().split()))\nfl = lambda: list(map(float, sys.stdin.buffer.readline().split()))\niln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]\n\niss = lambda: sys.stdin.buffer.readline().decode().rstrip()\nsl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))\nisn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]\n\nlcm = lambda x, y: x * y / math.gcd(x, y)\n\nMOD = 10 ** 9 + 7\nMAX = float(\'inf\')\n\n\ndef f(A, B, x):\n return math.floor(A * x / B) - A * math.floor(x / B)\n\n\ndef main():\n if os.getenv("LOCAL"):\n sys.stdin = open("input.txt", "r")\n\n A, B, N = il()\n ret = 0\n mi = math.floor(B / N) + math.floor(A / N)\n for n in range(0, B):\n ret = max(ret, f(A, B, n))\n print(ret)\n\n\nif __name__ == \'__main__\':\n main()\n', 'import sys\nimport os\nimport math\nimport bisect\nimport collections\n\nii = lambda: int(sys.stdin.buffer.readline().rstrip())\nil = lambda: list(map(int, sys.stdin.buffer.readline().split()))\nfl = lambda: list(map(float, sys.stdin.buffer.readline().split()))\niln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]\n\niss = lambda: sys.stdin.buffer.readline().decode().rstrip()\nsl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))\nisn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]\n\nlcm = lambda x, y: x * y / math.gcd(x, y)\n\nMOD = 10 ** 9 + 7\nMAX = float(\'inf\')\n\n\ndef f(A, B, x):\n return math.floor(A * x / B) - A * math.floor(x / B)\n\n\ndef main():\n if os.getenv("LOCAL"):\n sys.stdin = open("input.txt", "r")\n\n A, B, N = il()\n ret = 0\n for n in range(N, B):\n ret = max(ret, f(A, B, n))\n print(ret)\n\n\nif __name__ == \'__main__\':\n main()\n', 'import sys\nimport os\nimport math\nimport bisect\nimport collections\nimport itertools\n\nii = lambda: int(sys.stdin.buffer.readline().rstrip())\nil = lambda: list(map(int, sys.stdin.buffer.readline().split()))\nfl = lambda: list(map(float, sys.stdin.buffer.readline().split()))\niln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]\n\niss = lambda: sys.stdin.buffer.readline().decode().rstrip()\nsl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))\nisn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]\n\nlcm = lambda x, y: x * y / math.gcd(x, y)\n\nMOD = 10 ** 9 + 7\nMAX = float(\'inf\')\n\n\ndef f(A, B, x):\n return math.floor(A * x / B) - A * math.floor(x / B)\n\n\ndef main():\n if os.getenv("LOCAL"):\n sys.stdin = open("input.txt", "r")\n\n A, B, N = il()\n print(f(A, B, min(B - 1, N)))\n\n\nif __name__ == \'__main__\':\n main()\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s253653397', 's739037080', 's832779981']
[9504.0, 9384.0, 9560.0]
[2206.0, 2205.0, 23.0]
[1001, 937, 900]
p02696
u636502712
2,000
1,048,576
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.
['a,b,n=map(int,input().split())\nimport math\nans=0\nfor i in range(1,a+1):\n ans=max(ans,math.floor(a*i/b)-a*math.floor(i/b))\nprint(ans)', 'a,b,n=map(int,input().split())\nimport math\nans=0\nd=min(n,b)\ne=b-1\nif b>d:\n print(math.floor(a*d/b)-a*math.floor(d/b))\nelse:\n print(math.floor(a*e/b)-a*math.floor(e/b))']
['Wrong Answer', 'Accepted']
['s867502027', 's490088126']
[9164.0, 9180.0]
[557.0, 22.0]
[135, 173]
p02696
u639343026
2,000
1,048,576
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.
['import sys\ndef input(): return sys.stdin.readline().strip()\ndef INT(): return int(input())\ndef MAP(): return map(int, input().split())\ndef LIST(): return list(map(int, input().split()))\n\na,b,x=MAP()\n\ndef f(n):\n return (a*n)//b-a*(n//b)\n\nans=0\npre=0\nnow=x//2\nans=f(now)\ni=1\nwhile True:\n i+=1\n if x//(2**i)==0:\n break\n pre_1=f(now-x//(2**i))\n pre_2=f(now+x//(2**i))\n if pre_1<pre_2:\n ans=pre_2\n now=now+x//(2**i)\n else:\n ans=pre_1\n now=now-x//(2**i)\n\n\nfor i in range(now-10**5,now+10**5):\n pre=f(i)\n if ans<pre:\n ans=pre\nans2=ans\nans=0\npre=0\nnow=x//2\nans=f(now)\ni=1\nwhile True:\n i+=1\n if x//(2**i)==0:\n break\n pre_1=f(now-x//(2**i))\n pre_2=f(now+x//(2**i))\n if i==2:\n pre_1,pre_2=pre_2,pre_1\n if pre_1<pre_2:\n ans=pre_2\n now=now+x//(2**i)\n else:\n ans=pre_1\n now=now-x//(2**i)\nfor i in range(now-10**5,now+10**5):\n pre=f(i)\n if ans<pre:\n ans=pre\n \nif ans<ans2:\n ans=ans2\nprint(ans)', 'import sys\ndef input(): return sys.stdin.readline().strip()\ndef INT(): return int(input())\ndef MAP(): return map(int, input().split())\ndef LIST(): return list(map(int, input().split()))\n\na,b,x=MAP()\n\ndef f(n):\n return (a*n)//b-a*(n//b)\n\nans=0\npre=0\nnow=x//2\nans=f(now)\ni=1\nwhile True:\n i+=1\n if x//(2**i)==0:\n break\n pre_1=f(now-x//(2**i))\n pre_2=f(now+x//(2**i))\n if pre_1<pre_2:\n ans=pre_2\n now=now+x//(2**i)\n else:\n ans=pre_1\n now=now-x//(2**i)\n\nfor i in range(now-1000,now+1000):\n pre=f(i)\n if ans<pre:\n ans=pre\nprint(ans)\n\n\n', 'import sys\ndef input(): return sys.stdin.readline().strip()\ndef INT(): return int(input())\ndef MAP(): return map(int, input().split())\ndef LIST(): return list(map(int, input().split()))\n\na,b,x=MAP()\n\ndef f(n):\n return (a*n)//b-a*(n//b)\n\nans=f(x)\n\nfor i in range(x-b-1000,x-b+1000):\n pre=f(i)\n if ans<pre:\n ans=pre\n\nfor i in range(x-b//a-1000,x-b//a-1000):\n pre=f(i)\n if ans<pre:\n ans=pre\n\nprint(ans)\n', 'import sys\ndef input(): return sys.stdin.readline().strip()\ndef INT(): return int(input())\ndef MAP(): return map(int, input().split())\ndef LIST(): return list(map(int, input().split()))\n\na,b,x=MAP()\n\ndef f(n):\n return (a*n)//b-a*(n//b)\n\nif b<=x:\n print(f(b-1))\nelse:\n print(f(x))\n']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s117667545', 's262143869', 's423509687', 's200935921']
[9324.0, 9236.0, 9208.0, 9188.0]
[187.0, 23.0, 21.0, 22.0]
[1033, 598, 429, 289]
p02696
u645487439
2,000
1,048,576
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.
['a, b, n = map(int, input().split())\nx = b - 1\n\nprint((a * x) // b)\n', 'a, b, n = map(int, input().split())\n\nif b > n:\n x = n\nelse:\n x = b - 1\n\nprint((a * x) // b)\n']
['Wrong Answer', 'Accepted']
['s480475053', 's524470247']
[9144.0, 9088.0]
[23.0, 19.0]
[67, 98]
p02696
u646110634
2,000
1,048,576
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.
['import sys\nA, B, N = map(int, input().split())\n\nif N < B :\n print(N * A // B - A * N // B)\n sys.exit()\nelse :\n print(((B-1) * A // B) - A * ((B-1) // B))', 'A, B, N = map(int, input().split())\n\nans = set()\nstart = B - 1\n\nfor i in range(1, N + 1, B):\n ans.add(int(i * A / B) - A * int(i / B))\n \nprint(max(ans))', 'A, B, N = map(int, input().split())\n\nif N < B :\n print(N * A // B - A * (N // B))\nelse :\n print((B-1) * A // B - A * ((B-1) // B))']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s077849967', 's676494408', 's623725940']
[9176.0, 9124.0, 8988.0]
[20.0, 2205.0, 20.0]
[156, 154, 132]
p02696
u648092704
2,000
1,048,576
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.
['def f(a, b, x):\n return a*x//b - a*(x//b)\n\na, b, n = map(int, input().split())\n\nt1 = f(a, b, n)\nt2 = f(a, b, n - n%b - 1)\nt = max(t1, t2)\n\nprint(t)', 'def f(a, b, x):\n return (a*x)//b - a*(x//b)\n\na, b, n = map(int, input().split())\n\nt1 = f(a, b, n)\nt2 = f(a, b, max(1, n - n%b - 1))\nt = max(t1, t2)\n\nprint(t)']
['Wrong Answer', 'Accepted']
['s491094676', 's370620085']
[9160.0, 9116.0]
[21.0, 21.0]
[150, 160]
p02696
u649326276
2,000
1,048,576
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.
['def nibutan(minval,maxval) :\n if maxval-minval<3 :\n return minval;\n elif (func(minval)-func((minval)//2+1))*(func((minval+maxval)//2+1)-func((minval+maxval)//2))<0 :\n return nibutan(minval,(minval+maxval)//2);\n else :\n return nibutan((minval+maxval)//2+1,maxval);\n\ndef func(x) :\n global a,b;\n return (a*x)//b-a*(x//b);\n\na,b,n = list(map(int,input().split()));\nans = nibutan(1,n);\nprint(max(func(ans),func(ans+1),func(ans+2)));', 'def func(x) :\n global a,b;\n return (a*x)//b-a*(x//b);\n\na,b,n = list(map(int,input().split()));\n\nif n < b :\n print(func(n));\nelse :\n print(func(b-1));']
['Wrong Answer', 'Accepted']
['s370611355', 's991029203']
[9036.0, 9076.0]
[24.0, 22.0]
[462, 161]
p02696
u649439030
2,000
1,048,576
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.
['a,b,n=map(int,input().split())\nprint((a*(n-1)/b)-(a*int((n-1)/b)))', 'a,b,n=map(int,input().split())\nif n>=b:\n x=b-1\nelse:\n x=n\nprint(int(a*x/b)-a*int(x/b))']
['Wrong Answer', 'Accepted']
['s995442197', 's263804533']
[9164.0, 9168.0]
[21.0, 22.0]
[66, 92]
p02696
u651109406
2,000
1,048,576
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.
['global A, B\nA, B, N = map(int, input().split())\n\ndef f(num):\n return(A * num) // B - A * (num // B)\n\nprint(max(f(N - N % B - 1), f(N)))\n', 'A, B, N = map(int, input().split())\n\ntmp = 0\na = 0\ni = 0\n\nif B > A:\n for i in range(B - 1, N + 1, B):\n if (s := (A * i) // B - A * (a)) > 0:\n tmp = max(s, tmp)\n else:\n break\n\nif i >= N - B:\n for i in range(N, N - N % B - 2, -1):\n if (s := (A * i) // B - A * (i // B)) > 0:\n tmp = max(s, tmp)\n else:\n break\n\nprint(tmp)\n', 'global A, B\nA, B, N = map(int, input().split())\n\ndef f(num):\n return(A * num) // B - A * (num // B)\n\nprint(f(min(B - 1, N)))']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s330424361', 's614412845', 's096425948']
[9104.0, 8972.0, 9012.0]
[22.0, 20.0, 21.0]
[139, 392, 127]
p02696
u652569315
2,000
1,048,576
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.
['a,b,n=map(int,input().split())\nl=a//b\nif n>=b-1:\n if a%b>0:\n print(a-l-1,1)\n else:\n print(a-1)\nelse:\n print(int(a*n//b)-a*(n//b),2)', 'a,b,n=map(int,input().split())\nl=a//b\nif b==1:\n print(0)\n exit()\nif n>=b-1:\n if a%b>0:\n print(a-l-1)\n else:\n print(a-1)\nelse:\n print(int((a*n)//b)-a*(n//b))']
['Wrong Answer', 'Accepted']
['s936106388', 's769794517']
[9112.0, 9180.0]
[23.0, 22.0]
[140, 167]
p02696
u652908807
2,000
1,048,576
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.
['#-*- coding: utf-8 -*-\na,b,n = map(int,input().split())\nif n>=b:\n n = b - 1\n print(int(a*n/b)-(a*n/b))\n exit():\nelse:\n print(int(a*n/b))\n exit():', '#-*- coding: utf-8 -*-\nimport math\na,b,n = map(int,input().split())\nx = min(b-1,n)\nans = math.floor(a*x//b)-a*math.floor(x/b)\nprint(ans)']
['Runtime Error', 'Accepted']
['s965078329', 's208636287']
[8812.0, 9036.0]
[18.0, 22.0]
[160, 136]
p02696
u653807637
2,000
1,048,576
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.
['def naive(a, b, n):\n\tans = 0\n\tfor i in range(1, n + 1):\n\t\tans = max(ans, int((a * i) / b) - a * int(i / b))\n\treturn ans\n\ndef main(a, b, n):\n\tans = 0\n\ttmp = []\n\tfor i in range(max(n + 1 - a * 10 - 1, 1), n + 1):\n\t\tans = max(ans, int((a * i) / b) - a * int(i / b))\n\treturn ans\n\n\nn = 10000\nfor a in range(1, 10):\n\tfor b in range(1, 100):\n\t\tif naive(a, b, n) != main(a, b, n):\n\t\t\tprint(a, b, naive(a, b, n), main(a, b, n))\n\na, b, n = list(map(int, input().split()))\nprint(main(a, b, n))', 'def val(a, b, x):\n\treturn (a * x) // b - a * (x // b)\n\ndef naive(a, b, n):\n\tans = 0\n\tfor i in range(1, n + 1):\n\t\tans = max(ans, int((a * i) / b) - a * int(i / b))\n\treturn ans\n\ndef main(a, b, n):\n\t\treturn max(val(a, b, n), val(a, b, (n // b) * b - 1), val(a, b, n - 1))\n\n# n = 100\n# for a in range(1, 100):\n# \tfor b in range(1, 1000):\n# \t\tif naive(a, b, n) != main(a, b, n):\n# \t\t\tprint(a, b, naive(a, b, n), main(a, b, n))\n\na, b, n = list(map(int, input().split()))\nprint(main(a, b, n))\n\n# a, b, n = 100, 1000, 100000\n# if naive(a, b, n) != main(a, b, n):\n# \tprint(a, b, naive(a, b, n), main(a, b, n))', 'def val(a, b, x):\n\treturn (a * x) // b - a * (x // b)\n\ndef naive(a, b, n):\n\tans = 0\n\tfor i in range(1, n + 1):\n\t\tans = max(ans, val(a, b, i))\n\treturn ans\n\ndef main(a, b, n):\n\t\treturn max(val(a, b, n), val(a, b, max((n // b) * b - 1, 1)), val(a, b, max(n - 1, 0)))\n\n# n = 10\n# for a in range(1, 1000):\n# \tfor b in range(1, 1000):\n# \t\tif naive(a, b, n) != main(a, b, n):\n# \t\t\tprint(a, b, naive(a, b, n), main(a, b, n))\n\na, b, n = list(map(int, input().split()))\nprint(main(a, b, n))\n']
['Time Limit Exceeded', 'Wrong Answer', 'Accepted']
['s286748613', 's797190320', 's706564611']
[8876.0, 9044.0, 9204.0]
[2205.0, 21.0, 22.0]
[482, 600, 481]
p02696
u655048024
2,000
1,048,576
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.
['a,b,n = map(int,input().split())\nans = -100000\nfor i in range(n+1):\n ans= max(ans,((a*i/b)//1-a*(i/b)//1))\nprint(ans)', 'a,b,n = map(int,input().split())\nif(b<=n):\n print(int((a*(b-1)/b)//1))\nelse:\n print(int((a*n/b)//1))\n\n']
['Wrong Answer', 'Accepted']
['s340330591', 's170809525']
[9176.0, 9124.0]
[2205.0, 22.0]
[118, 104]
p02696
u656391577
2,000
1,048,576
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.
['A, B, N = map(int, input().split())\n\ndef floor(t):\n return int(t)\n\nprint(floor((A*(B-1))/B) - A*floor((B-1)/B))', 'A, B, N = map(int, input().split())\n\ndef floor(t):\n return int(t)\n\nlist = []\n\nif N+1 > B:\n print(floor((A*(B-1))/B) - A*floor((B-1)/B))\nelse:\n print(floor((A*N/B) - A*floor(N/B)))']
['Wrong Answer', 'Accepted']
['s632264518', 's176015841']
[9172.0, 9112.0]
[20.0, 22.0]
[114, 188]
p02696
u667084803
2,000
1,048,576
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.
['A, B, N = map(int, input().split())\n\ndef calc(x):\n return (A*x)//B - A*(x//B)\n\nprint(max(calc(B-1), calc(N)))', 'A, B, N = map(int, input().split())\n\ndef calc(x):\n return (A*x)//B - A*(x//B)\n\nprint(calc(min(N,B-1)))']
['Wrong Answer', 'Accepted']
['s972106323', 's120066065']
[9168.0, 9164.0]
[21.0, 23.0]
[110, 103]
p02696
u667427469
2,000
1,048,576
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.
["def floor(a):\n return int(a)\n\nif __name__ == '__main__':\n abn = input()\n abn = abn.split()\n a = int(abn[0])\n b = int(abn[1])\n n = int(abn[2])\n\n max_amount = 0\n for i in range(0,min(b-1,n)):\n amount = floor(a*i/b) -a*floor(i/b)\n print(amount)\n max_amount = max(max_amount,amount)\n\n print(max_amount)\n", "def floor(a):\n return int(a)\n\nif __name__ == '__main__':\n abn = input()\n abn = abn.split()\n a = int(abn[0])\n b = int(abn[1])\n n = int(abn[2])\n\n max_amount = 0\n for i in range(1,b):\n amount = floor(a*i/b) -a*floor(i/b)\n max_amount = max(max_amount,amount)\n\n print(max_amount)\n", "def floor(a):\n return int(a)\n\nif __name__ == '__main__':\n abn = input()\n abn = abn.split()\n a = int(abn[0])\n b = int(abn[1])\n n = int(abn[2])\n\n x = min(b-1,n)\n ans = floor(a*x/b)-a*floor(x/b)\n\n print(ans)\n"]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s011153082', 's352456803', 's822730453']
[9372.0, 9132.0, 9084.0]
[2213.0, 2205.0, 21.0]
[347, 316, 232]
p02696
u670180528
2,000
1,048,576
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.
['a,b,n=map(int,input().split())\nf=lambda x:(a*x)//b-a*(x//b)\nprint(max(f(b-1),f(n)))', 'a,b,n=map(int,input().split())\nf=lambda x:(a*x)//b-a*(x//b)\nprint(f(min(b-1,n)))']
['Wrong Answer', 'Accepted']
['s473726041', 's299908931']
[9060.0, 9008.0]
[23.0, 20.0]
[83, 80]
p02696
u671446913
2,000
1,048,576
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.
['a, b, n = map(int, input().split())\nprint(n)\n', 'a, b, n = map(int, input().split())\n\nx = min(b. n)\nprint(int(a * x / b))\n', 'a, b, n = map(int, input().split())\n\nx = min(b - 1, n)\nprint(int(a * x / b))\n']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s127124077', 's868471996', 's186695788']
[9132.0, 9092.0, 9128.0]
[21.0, 19.0, 18.0]
[45, 73, 77]
p02696
u673101577
2,000
1,048,576
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.
["import math\n\nA, B, N = map(int, input().split(' '))\n\n\ndef calc(a, b, x):\n return math.floor((a * x) / b) - a * math.floor(x / b)\n\n\n_max = calc(A, B, 0)\nfor _x in range(1, N + 1):\n _temp = calc(A, B, _x)\n # print(_x, _max, _temp)\n if _temp == 0:\n break\n elif _temp > _max:\n _max = _temp\n\n# print('answer')\nprint(_max)\n\n", "import math\n\nA, B, N = map(int, input().split(' '))\n\n\nif math.floor(N / B) > 0:\n ans_x = B - 1\nelse:\n ans_x = N\n\nl = math.floor((A * ans_x) / B)\nr = A * math.floor(ans_x / B)\n\nans = l - r\n\nprint(ans)\n"]
['Wrong Answer', 'Accepted']
['s872003292', 's339729423']
[9184.0, 9016.0]
[23.0, 20.0]
[347, 235]
p02696
u674190122
2,000
1,048,576
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.
['a, b, n = [int(x) for x in input().split()]\nx = min(b - 1, n)\nanswer = floor(a * x / b) - a * floor(x / b)\nprint(answer)', 'from math import floor\na, b, n = [int(x) for x in input().split()]\nx = min(b - 1, n)\nanswer = floor(a * x / b) - a * floor(x / b)\nprint(answer)']
['Runtime Error', 'Accepted']
['s461550988', 's574063008']
[9120.0, 9036.0]
[24.0, 21.0]
[120, 143]
p02696
u674343825
2,000
1,048,576
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.
['A,B,N = map(int,input().split())\nprint(min(N,B-1))', 'A,B,N = map(int,input().split())\nx = min(N,B-1)\nans = int(A*x/B) - A*int(x/B)\nprint(ans)']
['Wrong Answer', 'Accepted']
['s426722020', 's159662611']
[8976.0, 9104.0]
[21.0, 20.0]
[50, 88]