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 | u119012830 | 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\ndef f(x):\n return (a * x) // b - (a * x) // b\n\n\nprint(f(min(n,b-1)))', 'a, b, n = map(int, input().split())\n\n\ndef f(x):\n return (a * x) // b - (a * x) // b\n\n\nprint(f(min(b-1, n)))', 'a, b, n = map(int, input().split())\n\n\ndef f(x):\n return (a * x) // b - a * (x // b)\n\n\nprint(f(min(n, b-1)))\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s863130398', 's972815430', 's853350917'] | [9104.0, 9100.0, 9152.0] | [22.0, 19.0, 20.0] | [109, 110, 111] |
p02696 | u123417393 | 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# Your code here!\nA,B,N=map(int,input().split())\n\nnum=N//B\nif num==0:\n n=N\nelse:\n n=B*num-1\n\ntemp1=(A*n)/B//1\ntemp2=A*((n/B)//1)\n\nprint(temp1-temp2)\n', '# coding: utf-8\n# Your code here!\nA,B,N=map(int,input().split())\n\nnum=N//B\nif num==0:\n n=N\nelse:\n n=B*num-1\n\n#print(n)\ntemp1=(A*n)/B//1\ntemp2=A*((n/B)//1)\n\nprint(int(temp1-temp2))\n'] | ['Wrong Answer', 'Accepted'] | ['s863569656', 's719637051'] | [9232.0, 9168.0] | [24.0, 21.0] | [171, 186] |
p02696 | u123756661 | 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 i in range(b,max(b-3,-1),-1):\n ans=max(ans,((a*i)//b-(a*(i//b))))\nprint(ans)\n', 'a,b,n=map(int,input().split())\n\nans=0\nt=min(b,n)\nfor i in range(t,max(t-3,-1),-1):\n ans=max(ans,((a*i)//b-(a*(i//b))))\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s779174412', 's756588617'] | [9092.0, 9072.0] | [21.0, 20.0] | [122, 133] |
p02696 | u132687480 | 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\ndef Main(A, B, N):\n a = floor(A*N/B)-A*floor(N/B)\n b = floor(A*(B-1)/B)-A*floor((B-1)/B)\n return max(a, b)\n\ndef main():\n A, B, N =map(int, input().split()) \n print(Main(A, B, N))\n\nif __name__ == '__main__':\n main()", "from math import floor\ndef Main(A, B, N):\n if N < B:\n return floor(A*N/B)-A*floor(N/B)\n else:\n return floor(A*(B-1)/B)-A*floor((B-1)/B)\n\ndef main():\n A, B, N =map(int, input().split()) \n print(Main(A, B, N))\n\nif __name__ == '__main__':\n main()"] | ['Wrong Answer', 'Accepted'] | ['s257120152', 's545333935'] | [9060.0, 9056.0] | [20.0, 23.0] | [255, 272] |
p02696 | u133174241 | 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())\ndef f(x):\n return int(a*x/b) - a*int(x/b)\nsyou = n//b\nMax = 0\nfor i in range(0,a+1):\n syou1 = syou - i\n Max = max(f(syou1*b-1),f(syou*b-1),Max)\nMax = max(Max,f(n),f((syou+1)*b-1))\nprint(Max)', 'a,b,n = map(int, input().split())\ndef f(x):\n return int(a*x/b) - a*int(x/b)\nMax = max(f(b-1),f(n))\nprint(Max)', 'a,b,n = map(int, input().split())\ndef f(x):\n return int(a*x/b) - a*int(x/b)\nMax = f(min(b-1,n))\nprint(Max)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s176908752', 's483998001', 's895941448'] | [9204.0, 9168.0, 9168.0] | [1656.0, 22.0, 22.0] | [233, 112, 109] |
p02696 | u135116520 | 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=math.floor((A*(B-1))/B)\nt=math.floor((A*N)/B)\nprint(max(s,t))', 'import math\nA,B,N=map(int,input().split())\ns=math.floor((A*B-1)/B)\nt=math.floor((A*N)/B)\nprint(max(s,t))\n', 'import math\nA,B,N=map(int,input().split())\nx=0\nC=[]\nwhile math.floor(x/B)==0:\n s=math.floor(A*x/B)-A*math.floor(x/B)\n C.append(s)\n x+=1\nprint(max(C))\n', 'A,B,N=map(int,input().split())\ns=math.floor((A*(B-1))/B))\nt=math.floor((A*N)/B))\nprint(max(s,t))', 'import math\nA,B,N=map(int,input().split())\ns=math.floor((A*(B-1))/B))\nt=math.floor((A*N)/B))\nprint(max(s,t))', 'import math\nA,B,N=map(int,input().split())\ns=math.floor((A*(B-1))/B)\nt=math.floor((A*N)/B)\nprint(min(s,t))'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s008763626', 's545903580', 's551930400', 's695261015', 's742385765', 's915583588'] | [9152.0, 9036.0, 42524.0, 8916.0, 8912.0, 9116.0] | [20.0, 23.0, 2206.0, 21.0, 19.0, 25.0] | [106, 105, 153, 96, 108, 106] |
p02696 | u135389999 | 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\ndef calc(a, b, n):\n return int(math.floor((a * n)/b) - (a * math.floor(n/b)))\n\n\nprint(max(calc(a, b, n), calc(a, b, b-1)))', 'import math\na, b, n = map(int, input().split())\n \n \ndef calc(a, b, n):\n return int(math.floor((a * n)/b) - (a * math.floor(n/b)))\n \nnn = min(n, b - 1)\nprint(calc(a, b, nn)', 'import math\na, b, n = map(int, input().split())\n \n \ndef calc(a, b, n):\n return int(math.floor((a * n)/b) - (a * math.floor(n/b)))\n \nif n <= b -1:\n print(calc(a,b,n))\nelse:\n print(calc(a,b,b-1))'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s397532975', 's934894121', 's670569768'] | [9192.0, 9036.0, 9108.0] | [21.0, 25.0, 32.0] | [175, 174, 198] |
p02696 | u136843617 | 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 solve():\n A, B, N = map(float, input().split())\n\n ans = 0\n div_ab = A/B\n div_1b = 1/B\n init_1 = (max(1, int(N)-100000)*A)/B\n init_2 = max(1, int(N)-100000)/B\n start = max(1, int(N)-100000)\n\n for i in range(max(1, int(N)-100000), int(N) + 1):\n ans = max(math.floor(init_1+div_ab*(i-start)) - A*math.floor(init_2+div_1b*(i-start)),ans)\n start = max(B-1000,1)\n init_1 = (max(1, int(B-100000)) * A) / B\n init_2 = max(1, int(B-100000)) / B\n for i in range(max(B-100000,1), int(B)+1):\n ans = max(math.floor(init_1 + div_ab * (i - start)) - A * math.floor(init_2 + div_1b * (i - start)), ans)\n\n print(int(ans))\n\n\nif __name__ == '__main__':\n solve()\n", "import math\n\n\ndef solve():\n A, B, N = map(float, input().split())\n\n ans = 0\n div_ab = A/B\n div_1b = 1/B\n init_1 = (max(1, int(N)-100000)*A)/B\n init_2 = max(1, int(N)-100000)/B\n start = max(1, int(N)-100000)\n\n for i in range(max(1, int(N)-100000), int(N) + 1):\n ans = max(math.floor(init_1+div_ab*(i-start)) - A*math.floor(init_2+div_1b*(i-start)),ans)\n start = max(B-1000,1)\n init_1 = (max(1, int(B-100000)) * A) / B\n init_2 = max(1, int(B-100000)) / B\n for i in range(max(int(B-100000),1), max(N,int(B)+1)):\n ans = max(math.floor(init_1 + div_ab * (i - start)) - A * math.floor(init_2 + div_1b * (i - start)), ans)\n\n print(int(ans))\n\n\nif __name__ == '__main__':\n solve()\n", "import math\n\n\ndef solve():\n A, B, N = map(int, input().split())\n\n ans = 0\n div_ab = A/B\n div_1b = 1/B\n\n for i in range(max(1, N-100000), N + 1):\n ans = max(math.floor(div_ab*i) - A*math.floor(div_1b*i),ans)\n if N > B:\n for j in range(max(int(B)-10000,1), int(B)+1):\n ans = max(math.floor(div_ab * j) - A * math.floor(div_1b * j), ans)\n\n for k in reversed(range(N-100*B,N+1,B)):\n ans = max(math.floor(div_ab * k) - A * math.floor(div_1b * k), ans)\n for j in range(N-100, N+1):\n ans = max(math.floor(div_ab * j) - A * math.floor(div_1b * j), ans)\n print(int(ans))\n\n\nif __name__ == '__main__':\n solve()\n", 'def solve():\n A,B,N = map(int, input().split())\n if N < B-1:\n print((A*N)//B - A * (N//B))\n else:\n print(((A*(B-1))//B) - A* ((B-1)//B))\n\n\nif __name__ == "__main__":\n solve()\n'] | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s042135056', 's839739422', 's890083960', 's333961598'] | [9180.0, 9092.0, 9244.0, 9060.0] | [80.0, 119.0, 70.0, 22.0] | [716, 728, 669, 201] |
p02696 | u143051858 | 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())\nmax_num = 0\nx = min(B-1,N)\nprint(int((A*x)/B)-(A*int(x/B)))'] | ['Wrong Answer', 'Accepted'] | ['s575697488', 's447863364'] | [9024.0, 9132.0] | [26.0, 29.0] | [49, 91] |
p02696 | u145950990 | 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())\nn%b==0:n-=1\nprint((a*n)//b-a*(n//b))', 'a,b,n = map(int,input().split())\nr = min(n,b-1)\nprint((a*r)//b)'] | ['Runtime Error', 'Accepted'] | ['s572232875', 's900056370'] | [9012.0, 9168.0] | [20.0, 22.0] | [69, 63] |
p02696 | u146066372 | 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# max=0\n\n# if a%b*i%b<i%b:\n# ans=a*i//b -a*(i//b)\n# if max<ans:\n# max=ans\n\n# print(max)\n\na,b,n=map(int,input().split())\nmax=0\n\nif b>=n:\n x=n\n ans=int(a*x/b) -int(a*x/b)\n\nelse:\n x=b-1\n ans=int(a*x/b)-int(a*x/b)\n\nprint(ans)\n ', 'a,b,n=map(int,input().split())\nmax=0\nfor i in range(1,n+1):\n if a%b*i%b!=0:\n if a%b*i%b<a%b\n ans=a*i//b -a*(i//b)\n if max<ans:\n max=ans\n\nprint(max)', '# a,b,n=map(int,input().split())\n# max=0\n\n# if a%b*i%b<i%b:\n# ans=a*i//b -a*(i//b)\n# if max<ans:\n# max=ans\n\n# print(max)\n\na,b,n=map(int,input().split())\nmax=0\n\nif b>n:\n x=n\n ans=(a*x)//b -a*(x//b)\n\nelse:\n x=b-1\n ans=(a*x)//b -a*(x//b)\n\nprint(ans)\n '] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s033923679', 's728757213', 's667248155'] | [9164.0, 8904.0, 9156.0] | [28.0, 26.0, 28.0] | [327, 194, 319] |
p02696 | u150787983 | 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*i/B) - A * math.floor(i/B))\nelse:\n print(math.floor(A*(B-1)/B))', 'import math\nA, B, N = list(map(int, input().split(" ")))\nif B > N:\n print(math.floor(A*N/B) - A * math.floor(N/B))\nelse:\n print(math.floor(A*(B-1)/B))'] | ['Runtime Error', 'Accepted'] | ['s545214677', 's229683621'] | [9116.0, 9112.0] | [22.0, 24.0] | [156, 156] |
p02696 | u165394332 | 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()]\n\ndef floor(A: int, B: int, x: int) -> int:\n return (A * x) // B - A * (x // B)\n\nprev = -1\nfor n in range(N + 1, 0, -1):\n res = floor(A, B, n)\n if res < prev:\n print(prev)\n break\n prev = res\n', 'A, B, N = [int(i) for i in input().split()]\n\ndef f(x: int) -> int:\n return (A * x) // B - A * (x // B)\n\nx = min(N, B - 1)\nprint(f(x))\n'] | ['Wrong Answer', 'Accepted'] | ['s396394783', 's769969992'] | [9188.0, 9164.0] | [2205.0, 21.0] | [260, 137] |
p02696 | u165436807 | 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())\nS = 0\nn = N // B\nr = N % B\nif B > N:\n S = (A*N)//B\nelse:\n if r == 0:\n S = (A*(N-1))//B - A * ((N-1)//B))\n elif r == B - 1:\n S = (A*N)//B - A * (N//B)\n else:\n S = (A*(n*B-1))//B - A * ((n*B-1)//B)\n\nprint(S)\n', 'A,B,N = map(int,input().split())\nS = 0\nn = N // B\nif B <= N:\n for i in range(1,n+1):\n l = i * B - 1\n while S < max(S,(A*l)//B - A * (l//B))\n S = max(S,(A*l)//B - A * (l//B))\nelse:\n S = (A*N)//B\nprint(S)\n', 'A,B,N = map(int,input().split())\nS = 0\nn = N // B\nr = N % B\nif B > N:\n S = (A*N)//B\nelse:\n if r == 0:\n S = (A*(N-1))//B - A * ((N-1)//B))\n elif r == B - 1:\n S = (A*N)//B - A * (N//B)\n else:\n S = (A*(n*B-1))//B - A * ((n*B-1)//B)\n\nprint(S)\n', 'A,B,N = map(int,input().split())\nS = 0\nn = N // B\nr = N % B\nif B > N:\n S = (A*N)//B\nelse:\n if r == 0:\n S = (A*(N-1))//B - A * ((N-1)//B))\n elif r == B - 1:\n S = (A*N)//B - A * (N//B)\n else:\n S = (A*(n*B-1))//B - A * ((n*B-1)//B)\n\nprint(S)\n', 'A,B,N = map(int,input().split())\nS = 0\nn = N // B\nr = N % B\nif B > N:\n S = (A*N)//B\nelse:\n if r == 0:\n S = (A*(N-1))//B - A * ((N-1)//B)\n elif r == B - 1:\n S = (A*N)//B - A * (N//B)\n else:\n S = (A*(n*B-1))//B - A * ((n*B-1)//B)\n\nprint(S)\n'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s019271879', 's358538623', 's411659545', 's998221186', 's333458955'] | [8968.0, 8984.0, 8960.0, 8976.0, 8908.0] | [20.0, 24.0, 24.0, 20.0, 24.0] | [275, 231, 275, 273, 272] |
p02696 | u166340293 | 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())\nD=int(A*B/math.gcd(A,B))\nmaxi=0\nif B-1<=N:\n print((B-1)%B*A/B-(A*(B-1))%B/B)\nelse:\n print(N%B*A/B-(A*N)%B/B)', 'import math\nfrom fractions import gcd\nA,B,N=map(int,input().split())\nD=int(A*B/math.gcd(A,B))\nmaxi=0\nif D<N:\n for i in range(1,D+1):\n if (i%B)*A/B-(A*i)%B/B>maxi:\n maxi=(i%B)*A/B-(A*i)%B/B\nelse:\n for i in range(1,N+1):\n if (i%B)*A/B-(A*i)%B/B>maxi:\n maxi=(i%B)*A/B-(A*i)%B/B\nprint(int(maxi))', 'import math\nA,B,N=map(int,input().split())\nD=int(A*B/math.gcd(A,B))\nmaxi=0\nif B-1<=N:\n print(int((B-1)%B*A/B-(A*(B-1))%B/B))\nelse:\n print(int(N%B*A/B-(A*N)%B/B))'] | ['Wrong Answer', 'Time Limit Exceeded', 'Accepted'] | ['s256355461', 's830566913', 's514933724'] | [9192.0, 10356.0, 9100.0] | [19.0, 2206.0, 23.0] | [153, 309, 163] |
p02696 | u166511804 | 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. | ["\nimport math\n\nA, B, N = map(int, input().split(' '))\nx = B\nprint(math.floor((A * x) / B) - A * (math.floor(x / B)))\n", "\ndef resolve():\nA, B, N = map(int, input().split(' '))\nans = 0\nfor x in range(N + 1):\n res = math.floor((A * x / B) - A * math.floor(x / B))\n ans = max(ans, res)\nprint(ans)\n", "\nA, B, N = map(int, input().split(' '))\nans = 0\nfor x in range(N + 1):\n res = math.floor((A * x / B) - A * math.floor(x / B))\n ans = max(ans, res)\nprint(ans)\n", "import math\n\nA, B, N = map(int, input().split(' '))\nx = min(B, N + 1) - 1\nprint(math.floor((A * x) / B) - A * (math.floor(x / B)))\n"] | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s584863120', 's614120755', 's933370332', 's929737086'] | [9152.0, 9008.0, 9108.0, 9016.0] | [21.0, 21.0, 21.0, 21.0] | [116, 179, 164, 131] |
p02696 | u169696482 | 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\ny = b-1\nif x < n:\n x = y\nelse:\n x = n\n\nprint(math.floor(a*x/b))', 'import math\na, b, n = map(int, input().split())\n\ny = b-1\nx = 0\nif x < n:\n x = y\nelse:\n x = n\n\nprint(math.floor(a*x/b))', 'import math\na, b, n = map(int, input().split())\n\ny = b-1\nx = 0\nif y < n:\n x = y\nelse:\n x = n\nprint(math.floor(a*x/b))'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s127814024', 's136064655', 's495166278'] | [9112.0, 9112.0, 9168.0] | [22.0, 23.0, 21.0] | [114, 120, 119] |
p02696 | u169702930 | 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())\ntmp = int(n/b)\nresult = 0\nresult = b*tmp - 1\nif result > n: result = n\nprint(int(a*result/b) - a*int(result/b))', 'import math\n\na,b,n = map(int, input().split())\ntmp = int(n/b)\nresult = 0\nif tmp != 0:\n result = b - 1\nelse:\n result = n\nprint(math.floor((a*result)/b) - a*math.floor(result/b))'] | ['Wrong Answer', 'Accepted'] | ['s209842595', 's498354000'] | [9172.0, 9120.0] | [18.0, 23.0] | [145, 182] |
p02696 | u170839742 | 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 *\n\n\ndef target(x):\n x = Decimal(x)\n return (A * x).divmod(B) - A * (x.divmod(B))\n\n\nA, B, N = map(int, input().split())\nA = Decimal(A)\nB = Decimal(B)\n\nleft = 1\nright = N\n\nwhile right - left > 1:\n mid = left + (right - left) // 2\n y = target(mid)\n prv = target(mid - 1)\n nxt = target(mid + 1)\n if prv <= y <= nxt:\n left = mid\n else:\n right = mid\n\n\nprint(target(right))\n', 'from decimal import *\n\n\ndef target(x):\n x = Decimal(x)\n return (A * x).divmod(B) - A * (x.divmod(B))\n\n\nA, B, N = map(int, input().split())\nA = Decimal(A)\nB = Decimal(B)\n\nleft = 1\nright = N\n\nwhile right - left > 1:\n mid = left + (right - left) // 2\n y = target(mid)\n prv = target(mid - 1)\n nxt = target(mid + 1)\n if prv <= y <= nxt:\n left = mid\n else:\n right = mid\n\n\nprint(target(right))\n', 'def target(x):\n return (A * x) // B - A * (x // B)\n\n\nA, B, N = map(int, input().split())\nprint(target(min(B - 1, N)))'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s022195475', 's432101069', 's477428197'] | [10024.0, 10008.0, 9164.0] | [24.0, 28.0, 21.0] | [425, 425, 120] |
p02696 | u178465329 | 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 fractions\n\ndef gcd(a, b):\n while b:\n a, b = b, a%b\n return a\n\n\ndef reduce(p, q):\n common = fractions.gcd(p, q)\n return (p // common, q // common)\n\n\na, b, n = map(int, input().split(" "))\nx = 0\n\nif a != b:\n a,b = reduce(a,b)\n\n# print(a,b)\n\nif b <= n :\n x = b - 1\nelse:\n x = n\n\n\nans = a*x//b - a * (x//b)\n\n#print(a,b,x)\nprint(ans)', 'import fractions\n\ndef gcd(a, b):\n while b:\n a, b = b, a%b\n return a\n\n\ndef reduce(p, q):\n common = fractions.gcd(p, q)\n return (p // common, q // common)\n\n\na, b, n = map(int, input().split(" "))\nx = 0\n\na,b = reduce(a,b)\n\nif b < n :\n x = b - 1\nelse:\n x = n\n\n\nans = a*x//b - a * (x//b)\n\n#print(a,b,x)\nprint(ans)', 'import fractions\n\ndef gcd(a, b):\n while b:\n a, b = b, a%b\n return a\n\n\ndef reduce(p, q):\n common = fractions.gcd(p, q)\n return (p // common, q // common)\n\n\na, b, n = map(int, input().split(" "))\nx = 0\n\na,b = reduce(a,b)\n\nif b <= n :\n x = b - 1\nelse:\n x = n\n\n\nans = a*x//b - a * (x//b)\n\n#print(a,b,x)\nprint(ans)', 'import fractions\n\ndef gcd(a, b):\n while b:\n a, b = b, a%b\n return a\n\n\ndef reduce(p, q):\n common = fractions.gcd(p, q)\n return (p // common, q // common)\n\n\na, b, n = map(int, input().split(" "))\nx = 0\n\n#if a != b:\n# a,b = reduce(a,b)\n \n\n#print(a,b)\n\nif b <= n :\n x = b - 1\nelse:\n x = n\n\n\nans = (a*x)//b - a*(x//b)\n\n#print(a,b,x)\nprint(ans)'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s617070509', 's785615548', 's863899407', 's658882625'] | [10536.0, 10672.0, 10684.0, 10456.0] | [34.0, 34.0, 33.0, 31.0] | [363, 333, 334, 369] |
p02696 | u181195295 | 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 a==1:\n print(0)\nelse:\n c = max(b-1, n)\n print((a*c)//b)\n', 'a, b, n = map(int, input().split())\n\nif a==1:\n print(0)\nelse:\n c = min(b-1, n)\n print((a*c)//b)\n'] | ['Wrong Answer', 'Accepted'] | ['s299807737', 's564849650'] | [9164.0, 9160.0] | [18.0, 24.0] | [99, 99] |
p02696 | u185297444 | 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. | ['#ABC165d\nimport math\n\na, b, n = map(int,input().split())\nx = min(b-1,n)\nprint(x)\nprint(math.floor(a*x/b))\n', '#ABC165d\nimport math\n\na, b, n = map(int,input().split())\nx = min(b-1,n)\n\nprint(math.floor(a*x/b))\n'] | ['Wrong Answer', 'Accepted'] | ['s990305146', 's739482544'] | [9116.0, 9120.0] | [25.0, 20.0] | [106, 98] |
p02696 | u188138642 | 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\ndef fun(x):\n return np.floor(A*x/B)-A*np.floor(x/B)\n\nA, B, N = map(int,input().split())\nx = np.arange(0, B, 1)\nprint(fun(x))\nprint(int(max(fun(x))))\n', 'import math\ndef fun(A, B, x):\n return math.floor(A*x/B)-A*math.floor(x/B)\n\nA, B, N = map(int,input().split())\nx = min(B-1, N)\nprint(int(fun(A, B, x)))\n'] | ['Runtime Error', 'Accepted'] | ['s928274293', 's219741985'] | [27344.0, 9160.0] | [101.0, 23.0] | [171, 154] |
p02696 | u189023301 | 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\n\ndef main():\n a, b, n = map(int, input().split())\n x = min(n + 1, b - 1)\n X = (a * x) // b\n Y = a * (x // b)\n print(X - Y)\nif __name__ == '__main__':\n main()\n", "import sys\ninput = sys.stdin.readline\n\ndef main():\n a, b, n = map(int, input().split())\n x = min(n, b - 1)\n X = (a * x) // b\n Y = a * (x // b)\n print(X - Y)\nif __name__ == '__main__':\n main()\n"] | ['Wrong Answer', 'Accepted'] | ['s650247562', 's306412971'] | [9172.0, 9172.0] | [22.0, 21.0] | [214, 210] |
p02696 | u189397279 | 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\ndef floor(A, B, X):\n return(int(A * X / B) - (A * int(X / B)))\n\nA, B, N = map(int, sys.stdin.readline().split())\nprint(floor(A, B, B - 1))', 'import sys\n\ndef calc_floor(A, B, X):\n return (int(A * X / B) - A * int(X / B))\n\nA, B, N = map(int, sys.stdin.readline().split())\nif N >= B - 1:\n print(calc_floor(A, B, B - 1))\nelse:\n print(calc_floor(A, B, N))'] | ['Wrong Answer', 'Accepted'] | ['s249524471', 's861088486'] | [9052.0, 9132.0] | [24.0, 23.0] | [153, 218] |
p02696 | u189487046 | 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. | ['\nA, B, N = map(int, input().split())\nprint(abs(A-B)+1)', 'import math\n\nA, B, N = map(int, input().split())\nx = max(B-1, N)\nprint(math.floor((A*x)/B)-A*(x//B)', 'import math\n\nA, B, N = map(int, input().split())\nx = max(B-1, N)\nprint(math.floor((A*x)/B)-A*(x//B))\n', 'import math\n\nA, B, N = map(int, input().split())\nx = min(B-1, N)\nprint(math.floor((A*x)/B)-A*(x//B))\n'] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s267513310', 's564872495', 's999957327', 's701682409'] | [9160.0, 8968.0, 9092.0, 9164.0] | [22.0, 23.0, 23.0, 22.0] | [54, 99, 101, 101] |
p02696 | u189513668 | 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\n\nA, B, N = map(int, input().split())\n\ns = B-1 if N > B-1 else N\n\nx = np.arange(0, s+1)\nX = A * (x % B) - (A * (x % B)) % B\n\nprint(int(np.max(X)))', 'import numpy as np\n\nA, B, N = map(int, input().split())\n\ns = B if N > B else N\n#print(s)\n\nx = np.arange(0, int(s/2))\nX = np.floor(A * x / B) - A * np.floor(x / B)\n\nprint(int(np.max(X)))', '# -*- coding: utf-8 -*-\nA,B,N = map(int, input().split())\n \ndef function(x):\n return (A*x)//B-A*(x//B)\n \nif B-1<=N:\n print(function(B-1))\nelse:\n print(function(N))'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s180809883', 's921123611', 's638812805'] | [27116.0, 27196.0, 9060.0] | [106.0, 135.0, 21.0] | [164, 185, 166] |
p02696 | u192154323 | 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())\nif b != 1:\n x = min(n, b-1)\n while x <= n:\n Max = max(math.floor(a*x/b) - a*math.floor(x/b),Max)\n x += b\nelse:\n Max = 0\nprint(Max)', 'import math\na,b,n = map(int,input().split())\nMax = 0\nif b != 1:\n x = min(n, b-1)\n while x <= n:\n Max = max(math.floor(a*x/b) - a * math.floor(x/b),Max)\n x += b\nelse:\n Max = 0\nprint(Max)\n'] | ['Runtime Error', 'Accepted'] | ['s706715487', 's019966546'] | [9188.0, 9120.0] | [22.0, 19.0] | [198, 209] |
p02696 | u195177386 | 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 = 0\nfor x in range(N+1):\n tmp = math.floor(A*x/B) - A*math.floor(x/B)\n if tmp <= ans:\n break\n ans = tmp\nprint(ans)', 'import math\nA, B, N = map(int, input().split())\n\n\ndef f(x):\n return math.floor(A*x/B) - A * math.floor(x/B)\n\n\nprint(f(min(B-1, N)))'] | ['Wrong Answer', 'Accepted'] | ['s952498477', 's036971774'] | [9104.0, 9084.0] | [22.0, 21.0] | [182, 134] |
p02696 | u196746947 | 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=-2\nif b<n:\n n=b\nmax=math.floor(a*n-1/b)\nprint(max)\n', 'import math\na,b,n=map(int,input().split())\nmax=-2\nif b<n:\n n=b\n\n max=math.floor(a*n-1/b)\nprint(max)\n', 'import math\na,b,n=map(int,input().split())\nmax=-2\nif n<b:\n max=math.floor(a*n/b)\nelse:\n #b<=n\n max=math.floor(a*(b-1)/b)\n \n\nprint(max)\n'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s566061255', 's945221713', 's479814375'] | [9164.0, 8964.0, 9164.0] | [20.0, 24.0, 21.0] | [101, 253, 147] |
p02696 | u199830845 | 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 random\nsys.setrecursionlimit(10 ** 6) \nto_index = lambda x: int(x) - 1 \nprint_list_in_2D = lambda x: print(*x, sep="\\n") \n\n\ndef input_int():\n return int(input())\n\ndef map_int_input():\n return map(int, input())\n\nMII = map_int_input\n\ndef MII_split():\n return map(int, input().split())\n\ndef MII_to_index():\n return map(to_index, input())\n\ndef MII_split_to_index():\n return map(to_index, input().split())\n\n\ndef list_int_inputs():\n return list(map(int, input()))\n\nLII = list_int_inputs\n\ndef LII_split():\n return list(map(int, input().split()))\n\n\ndef LII_2D(rows_number):\n return [LII() for _ in range(rows_number)]\n\ndef LII_split_2D(rows_number):\n return [LII_split() for _ in range(rows_number)]\n\nimport math\nA, B, N = MII_split()\n\ndef f(x):\n \n return math.floor(A * x / B) - A * math.floor(x / B)\n\n\n\n# h = 1e-4\n# return (f(x + h) - f(x - h)) / (2 * h)\n#\n\n\n\n# x = initial\n#\n\n# for _ in range(steps):\n\n# grad = numerical_diff(f, x)\n\n# x -= learning_rate * grad\n#\n\n# return f(x)\n\nma = 0\nfor _ in range(10 ** 6*1.5):\n ini = random.randrange(N + 1)\n \n tmp = f(ini)\n if ma < tmp:\n ma = tmp\n\nprint(ma)', 'import sys\nimport random\nsys.setrecursionlimit(10 ** 6) \nto_index = lambda x: int(x) - 1 \nprint_list_in_2D = lambda x: print(*x, sep="\\n") \n\n\ndef input_int():\n return int(input())\n\ndef map_int_input():\n return map(int, input())\n\nMII = map_int_input\n\ndef MII_split():\n return map(int, input().split())\n\ndef MII_to_index():\n return map(to_index, input())\n\ndef MII_split_to_index():\n return map(to_index, input().split())\n\n\ndef list_int_inputs():\n return list(map(int, input()))\n\nLII = list_int_inputs\n\ndef LII_split():\n return list(map(int, input().split()))\n\n\ndef LII_2D(rows_number):\n return [LII() for _ in range(rows_number)]\n\ndef LII_split_2D(rows_number):\n return [LII_split() for _ in range(rows_number)]\n\nimport math\nA, B, N = MII_split()\n\ndef f(x):\n \n return math.floor(A * x / B) - A * math.floor(x / B)\n\ndef numerical_diff(f, x):\n \n h = 1e-4\n return (f(x + h) - f(x - h)) / (2 * h)\n\ndef gradient_descent(f, initial, learning_rate=1, steps=10**5):\n \n \n x = initial\n\n \n for _ in range(steps):\n \n grad = numerical_diff(f, x)\n \n x -= learning_rate * grad\n\n \n return f(x)\n\nma = 0\nfor _ in range(100):\n ini = random.randrange(N + 1)\n tmp = gradient_descent(f, ini)\n # tmp = f(ini)\n if ma < tmp:\n ma = tmp\n\n\nprint(ma)\n', 'import sys\nimport random\nsys.setrecursionlimit(10 ** 6) \nto_index = lambda x: int(x) - 1 \nprint_list_in_2D = lambda x: print(*x, sep="\\n") \n\n\ndef input_int():\n return int(input())\n\ndef map_int_input():\n return map(int, input())\n\nMII = map_int_input\n\ndef MII_split():\n return map(int, input().split())\n\ndef MII_to_index():\n return map(to_index, input())\n\ndef MII_split_to_index():\n return map(to_index, input().split())\n\n\ndef list_int_inputs():\n return list(map(int, input()))\n\nLII = list_int_inputs\n\ndef LII_split():\n return list(map(int, input().split()))\n\n\ndef LII_2D(rows_number):\n return [LII() for _ in range(rows_number)]\n\ndef LII_split_2D(rows_number):\n return [LII_split() for _ in range(rows_number)]\n\nimport math\nA, B, N = MII_split()\n\ndef f(x):\n \n return math.floor(A * x / B) - A * math.floor(x / B)\n\ndef numerical_diff(f, x):\n \n h = 1e-4\n return (f(x + h) - f(x - h)) / (2 * h)\n\ndef gradient_descent(f, initial, learning_rate=1, steps=10**2):\n \n \n x = initial\n\n \n for _ in range(steps):\n \n grad = numerical_diff(f, x)\n \n x -= learning_rate * grad\n\n \n return f(x)\n\nma = 0\nfor _ in range(N/2):\n ini = random.randrange(N + 1)\n tmp = gradient_descent(f, ini)\n # tmp = f(ini)\n if ma < tmp:\n ma = tmp\n\n\nprint(ma)', 'import sys\nimport random\nsys.setrecursionlimit(10 ** 6) \nto_index = lambda x: int(x) - 1 \nprint_list_in_2D = lambda x: print(*x, sep="\\n") \n\n\ndef input_int():\n return int(input())\n\ndef map_int_input():\n return map(int, input())\n\nMII = map_int_input\n\ndef MII_split():\n return map(int, input().split())\n\ndef MII_to_index():\n return map(to_index, input())\n\ndef MII_split_to_index():\n return map(to_index, input().split())\n\n\ndef list_int_inputs():\n return list(map(int, input()))\n\nLII = list_int_inputs\n\ndef LII_split():\n return list(map(int, input().split()))\n\n\ndef LII_2D(rows_number):\n return [LII() for _ in range(rows_number)]\n\ndef LII_split_2D(rows_number):\n return [LII_split() for _ in range(rows_number)]\n\nimport math\nA, B, N = MII_split()\n\ndef f(x):\n \n return math.floor(A * x / B) - A * math.floor(x / B)\n\ndef numerical_diff(f, x, h=B):\n \n return (f(x + h) - f(x - h)) / (2 * h)\n\ndef gradient_descent(f, initial, learning_rate=1, steps=10 ** 5):\n \n \n x = initial\n\n \n for step in range(steps):\n \n grad = numerical_diff(f, x)\n x -= learning_rate * grad\n if x < 0:\n x = 0\n elif x > N:\n x = N\n\n \n return f(x)\n\nma = 0\nfor _ in range(10 ** 2):\n ini = random.randrange(N + 1)\n tmp = gradient_descent(f, ini)\n # tmp = f(ini)\n if ma < tmp:\n ma = tmp\n\nprint(ma)', 'import sys\nsys.setrecursionlimit(10 ** 6) \nto_index = lambda x: int(x) - 1 \nprint_list_in_2D = lambda x: print(*x, sep="\\n") \n\n\ndef input_int():\n return int(input())\n\ndef map_int_input():\n return map(int, input())\n\nMII = map_int_input\n\ndef MII_split():\n return map(int, input().split())\n\ndef MII_to_index():\n return map(to_index, input())\n\ndef MII_split_to_index():\n return map(to_index, input().split())\n\n\ndef list_int_inputs():\n return list(map(int, input()))\n\nLII = list_int_inputs\n\ndef LII_split():\n return list(map(int, input().split()))\n\n\ndef LII_2D(rows_number):\n return [LII() for _ in range(rows_number)]\n\ndef LII_split_2D(rows_number):\n return [LII_split() for _ in range(rows_number)]\n\nimport math\n\nA, B, N = MII_split()\n\ndef f(x):\n return math.floor(A * x / B) - A * math.floor(x / B)\n\n# max = 0\n# for x in range(min(B + 1, N + 1)):\n# if x > N:\n# break\n# fx = f(x)\n# # print(fx)\n# if fx > max:\n# max = fx\nprint(f(min(B-1, N)))'] | ['Runtime Error', 'Time Limit Exceeded', 'Runtime Error', 'Time Limit Exceeded', 'Accepted'] | ['s096456996', 's115987854', 's548644031', 's762656911', 's231694823'] | [9584.0, 9480.0, 9576.0, 9488.0, 9104.0] | [21.0, 2205.0, 24.0, 2205.0, 28.0] | [2020, 1982, 1981, 1999, 1287] |
p02696 | u208309047 | 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(a, b, n):\n fl1 = (a * (n + 1)) // b\n fl2 = (n + 1) // b\n fl = fl1 - a * fl2\n return fl\n #return int(a * n / b) - a * int(n / b)\n\nprint(f(A, B, B-1) if N >= B-1 else f(A, B, N))', 'A,B,N = map(int, input().split())\n\ndef f(a, b, n):\n fl1 = (a * (n + 1)) // b\n fl2 = (n + 1) // b\n fl = fl1 - a * fl2\n return fl\n\nprint(f(a, b, b-1) if n >= b-1 else f(a, b, n))', 'A,B,N = map(int, input().split())\n\ndef f(a, b, n):\n fl1 = (a * n) // b\n fl2 = n // b\n fl = fl1 - (a * fl2)\n return fl\n #return int(a * n / b) - a * int(n / b)\n\nprint(f(A, B, B-1) if N >= B-1 else f(A, B, N))'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s301269803', 's342089124', 's286076413'] | [9180.0, 9180.0, 9124.0] | [25.0, 23.0, 20.0] | [231, 188, 221] |
p02696 | u212328220 | 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\n\n\n\nif N >= B - 1:\n x = B - 1\nelse:# N < B -1 :\n x = N\n\n\nyoshiki = np.floor(A*x / B) - A * np.floor(x/B)\nprint(yoshiki)', 'import numpy as np\nA, B, N = map(int, input().split())\n\n\nx = 0\n\nif N >= B - 1:\n x = B - 1\nelif N < B -1:\n x = N\n if not N % B == 0:\n pass\n else:\n x -= 1\n\n\nyoshiki = np.floor(A*x / B) - A * np.floor(x/B)\nprint(yoshiki)', 'import numpy as np\nA, B, N = map(int, input().split())\n\n\nx = 0\n\nif N >= B - 1:\n x = B - 1\nelif N < B -1:\n x = N\n if not N % B == 0:\n pass\n else:\n x -= 1\n\n\nyoshiki = np.floor((A*x) / B) - A * np.floor(x/B)\nprint(yoshiki)', 'A, B, N = map(int,input().split())\n\nimport numpy as np\n\nans = -100\nfor x in range(N+1):\n tmp = np.floor((A*x) / B) - (A * np.floor(x / B))\n if tmp > ans:\n ans = tmp\nprint(ans)', 'import math\na, b, n = map(int,input().split())\n# N = int(input())\n\n\nlst = []\nif b > n:\n x = n\nelse:\n x = b-1\n\nans = math.floor(a * x / b) - a * math.floor(x / b)\nprint(ans)'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s262913806', 's704501314', 's936462356', 's979269060', 's554891630'] | [27020.0, 26856.0, 27064.0, 27112.0, 8968.0] | [104.0, 105.0, 103.0, 2206.0, 27.0] | [180, 243, 245, 188, 216] |
p02696 | u212786022 | 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\nlo = 1\nhi = N\n\ndef f(x):\n return int(A*x/B)-A*int(x/B)\n\nans = 0\nif B-1<=N:\n ans = f(B-1)\n\nwhile hi > lo :\n if f(lo) <= f(hi):\n mid = (lo + hi) // 2\n if f(mid)<=f(mid+1):\n lo = mid+1\n else:\n lo = mid\n else:\n mid = -(-(lo + hi) // 2)\n hi = mid\n\nans = max(ans,f(lo),f(N-1),f(B*N//B-1))+1\n\nprint(ans)', 'A, B, N = map(int, input().split())\n\nlo = 1\nhi = N\n\ndef f(x):\n return int(A*x/B)-A*int(x/B)\n\nans = 0\nif B-1<=N:\n ans = f(B-1)\n\nwhile hi > lo :\n if f(lo) <= f(hi):\n mid = (lo + hi) // 2\n if f(mid)<=f(mid+1):\n lo = mid+1\n else:\n lo = mid\n else:\n mid = -(-(lo + hi) // 2)\n hi = mid\n\nans = max(ans,f(lo),f(N-1),f(B*N//B-1))-1\n\nprint(ans)', 'A, B, N = map(int, input().split())\n\nlo = 1\nhi = N\n\ndef f(x):\n return int(A*x/B)-A*int(x/B)\n\nans = 0\nif B-1<=N:\n ans = f(B-1)\n\nwhile hi > lo :\n if f(lo) <= f(hi):\n mid = (lo + hi) // 2\n if f(mid)<=f(mid+1):\n lo = mid+1\n else:\n lo = mid\n else:\n mid = -(-(lo + hi) // 2)\n hi = mid\n\nans = max(ans,f(lo),f(N-1),f(B*N//B-1),f(B-1))-1\n\nprint(ans)', 'from decimal import Decimal, getcontext\n\nA, B, N = map(int, input().split())\n\nlo = 1\nhi = N\n\ndef f(x):\n return int(Demical(A)*Demical(x)/Demical(B))-A*int(Demical(x)/Demical(B))\n\nans = 0\nif B-1<=N:\n ans = f(B-1)\n\nwhile hi > lo :\n if f(lo) <= f(hi):\n mid = (lo + hi) // 2\n if f(mid)<=f(mid+1):\n lo = mid+1\n else:\n lo = mid\n else:\n mid = -(-(lo + hi) // 2)\n hi = mid\n\nans = max(ans,f(lo),f(N-1),f(B*N//B-1))\n\nprint(ans)\n', 'A, B, N = map(int, input().split())\n\nlo = 1\nhi = N\n\ndef f(x):\n return int(A*x/B)-A*int(x/B)\n\nans = 0\nif B-1<=N:\n ans = f(B-1)\n\nwhile hi > lo :\n if f(lo) <= f(hi):\n mid = (lo + hi) // 2\n if f(mid)<=f(mid+1):\n lo = mid+1\n else:\n lo = mid\n else:\n mid = -(-(lo + hi) // 2)\n hi = mid\n\nans = max(ans,f(lo),f(N-1),f(B*N//B-1),f(B-1),f(A),f(N))\n\nprint(ans)', 'A, B, N = map(int, input().split())\n\nlo = 1\nhi = N\n\ndef f(x):\n return int(A*x/B)-A*int(x/B)\n\nans = 0\nif B-1<=N:\n ans = f(B-1)\n\nwhile hi > lo :\n if f(lo) <= f(hi):\n mid = (lo + hi) // 2\n if f(mid)<=f(mid+1):\n lo = mid+1\n else:\n lo = mid\n else:\n mid = -(-(lo + hi) // 2)\n hi = mid\n\nans = max(ans,f(lo),f(N-1),f(B*N//B-1)+1\n\nprint(ans)', 'A, B, N = map(int, input().split())\n\nlo = 1\nhi = N\n\ndef f(x):\n return int(A*x/B)-A*int(x/B)\n\nans = 0\nif B-1<=N:\n ans = f(B-1)\n\nwhile hi > lo :\n if f(lo) <= f(hi):\n mid = (lo + hi) // 2\n if f(mid)<=f(mid+1):\n lo = mid+1\n else:\n lo = mid\n else:\n mid = -(-(lo + hi) // 2)\n hi = mid\n\nans = max(ans,f(lo),f(N-1),f(B*N//B-1),f(B-1))+1\n\nprint(ans)', 'A, B, N = map(int, input().split())\n\ndef f(x):\n return int(A*x/B)-A*int(x/B)\n\nX = N\nY = min(B-1,N)\n\nprint(min(f(X),f(Y))', 'A, B, N = map(int, input().split())\n\ndef f(x):\n return (A*x)//B-A*(x//B)\n\nX = N\nY = min(B-1,N)\n\nprint(max(f(X),f(Y)))\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s012916702', 's094398994', 's251109391', 's556985573', 's648646359', 's755328245', 's779661566', 's881219156', 's770301980'] | [9120.0, 9128.0, 9216.0, 9900.0, 9228.0, 9084.0, 9224.0, 8896.0, 8928.0] | [21.0, 21.0, 22.0, 26.0, 22.0, 19.0, 20.0, 24.0, 19.0] | [402, 402, 409, 487, 417, 401, 409, 123, 121] |
p02696 | u213497190 | 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. x = map(int, input().split())\ndef f(x):\n return (a*x)//b - a*(x//b)\n\nprint(f(min(b-1, n))', 'a, b, n = map(int, input().split())\ndef f(x):\n return (a*x)//b - a*(x//b)\n \nprint(f(min(b-1, n)))'] | ['Runtime Error', 'Accepted'] | ['s354055373', 's131327089'] | [8936.0, 9136.0] | [20.0, 23.0] | [96, 98] |
p02696 | u221061152 | 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())\nT=[]\nfor i in range(max(1,N-100),N+1):\n t = math.floor(A*i/B)-A*math.floor(i/B)\n T.append(t)\nprint(T)\nprint(max(T))', '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))\n'] | ['Wrong Answer', 'Accepted'] | ['s769667594', 's593122022'] | [9124.0, 9084.0] | [22.0, 19.0] | [163, 104] |
p02696 | u225020286 | 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\nfor i in range(1,B+1):\n tmp=math.floor(A*i/B)-A*math.floor(i/B)\n if tmp>max:\n max=tmp\nprint(max)', 'import math\nA,B,N=map(int,input().split())\nmax=0\nif N<B:\n print(math.floor(A*N/B)-A*math.floor(N/B))\n exit()\ntmp=math.floor(A*(B-1)/B)-A*math.floor((B-1)/B)\nprint(tmp)'] | ['Wrong Answer', 'Accepted'] | ['s632193884', 's633380209'] | [9048.0, 9036.0] | [2206.0, 23.0] | [150, 169] |
p02696 | u228232845 | 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\nfrom sys import stdin\n\n\ndef input(): return sys.stdin.readline().strip()\ndef I(): return int(input())\ndef LI(): return list(map(int, input().split()))\ndef IR(n): return [I() for i in range(n)]\ndef LIR(n): return [LI() for i in range(n)]\ndef SR(n): return [S() for i in range(n)]\ndef S(): return input()\ndef LS(): return input().split()\n\n\na, b, n = LI()\nx = b - 1\nprint(int(a * x / b) - a * int(x / b))\n', 'import sys\nfrom sys import stdin\n\n\ndef input(): return sys.stdin.readline().strip()\ndef I(): return int(input())\ndef LI(): return list(map(int, input().split()))\ndef IR(n): return [I() for i in range(n)]\ndef LIR(n): return [LI() for i in range(n)]\ndef SR(n): return [S() for i in range(n)]\ndef S(): return input()\ndef LS(): return input().split()\n\n\na, b, n = LI()\nx = b - 1 if b - 1 <= n else n\nprint(int(a * x / b) - a * int(x / b))\n'] | ['Wrong Answer', 'Accepted'] | ['s104718333', 's842275744'] | [9120.0, 9124.0] | [25.0, 23.0] | [413, 434] |
p02696 | u235783479 | 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\nX = min(B-1, N)\n# ans = A * math.floor(X/B) - math.floor((A*X)/B)\nans = A * ((X/B) %1) - (A*X/B)%1\nprint(int(ans))\n\n', 'import math\nA, B, N = map(int, input().split())\n\nX = min(B-1, N)\nans = math.floor((A*X)/B) - A * math.floor((X)/B)\n# ans = A * ((X/B) %1) - (A*X/B)%1\nprint(int(ans))\n\n'] | ['Wrong Answer', 'Accepted'] | ['s769830432', 's860639481'] | [9032.0, 9156.0] | [22.0, 21.0] | [165, 167] |
p02696 | u236317938 | 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 = tuple(map(int, input().split()))\n\nm = 0\nn = 1\n\ndef cal(x):\n return math.floor(A*x/B)-A*math.floor(x/B)\n\nwhile n<N:\n c = B*(math.floor((n+1)/B)+1)-1\n n = min(N, c)\n m = max(cal(n), m)\n if (A*x)%B == 0:\n break\n \nprint(m)', 'import math\n\nA, B, N = tuple(map(int, input().split()))\n\nm = 0\nn = 1\n\ndef cal(x):\n return math.floor(A*x/B)-A*math.floor(x/B)\n\nwhile n<N:\n c = B*(math.floor((n+1)/B)+1)-1\n n = min(N, c)\n m = max(cal(n), m)\n if (A*n)%B == 0:\n break\n \nprint(m)\n'] | ['Runtime Error', 'Accepted'] | ['s204929393', 's578000660'] | [9072.0, 9132.0] | [21.0, 19.0] | [250, 251] |
p02696 | u242455652 | 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. | ['line = input().split(" ")\nA = int(line[0])\nB = int(line[1])\nN = int(line[2])\nmax = 0\nfor x in reversed(range(N+1)):\n S = int(A * x / B) - A * int(x / B)\n print(x)\n if max<S:\n max = S\n if int(x/B) != 0:\n break\nprint(max)\n', 'line = input().split(" ")\nA = int(line[0])\nB = int(line[1])\nN = int(line[2])\nmax = 0\nfor x in range(int(N/2), N+1):\n S = int(A * x / B) - A * int(x / B)\n \n if max<S:\n max = S\n print(max)\nprint(max)\n', 'line = input().split(" ")\nA = int(line[0])\nB = int(line[1])\nN = int(line[2])\nmax = 0\nif B<N:\n K = B\n for i in range(-1, 2):\n if max< (int(A * (K + i) / B) - A * int((K + i) / B)):\n max = int(A * (K + i) / B) - A * int((K + i) / B)\nelse:\n K = N\n for i in range(-1, 1):\n if max< (int(A * (K + i) / B) - A * int((K + i) / B)):\n max = int(A * (K + i) / B) - A * int((K + i) / B)\nprint(max)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s163331177', 's482133356', 's801718423'] | [31000.0, 9068.0, 9236.0] | [2256.0, 2205.0, 20.0] | [246, 221, 431] |
p02696 | u243714267 | 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\ncand = []\n\ndef calc(n):\n return int(a*n/b)-a*int(n/b)\n\ncand.append(calc(0))\ncand.append(calc(1))\ncand.append(calc(n))\ncand.append(calc(n-1))\ncand.append(calc(b*(n//b)))\ncand.append(calc(max(0, b*(n//b) - 1)))\ncand.append(calc(b-1))\n\nprint(max(cand))', 'a, b, n = map(int, input().split())\n \ncand = []\n \ndef calc(n):\n return int(a*n/b)-a*int(n/b)\n \ncand.append(calc(0))\ncand.append(calc(1))\ncand.append(calc(n))\ncand.append(calc(max(0, n-1)))\ncand.append(calc(max(0, b*(n//b) - 1)))\ncand.append(calc(min(n, max(0, b-1))))\n\nif b == 1:\n print(0)\nelse:\n print(max(cand))'] | ['Wrong Answer', 'Accepted'] | ['s409148925', 's964640484'] | [9208.0, 9208.0] | [19.0, 22.0] | [287, 316] |
p02696 | u247680229 | 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\nnum=round(A*N/B)-A*round(N/B)\n\n\nprint(num)', 'A,B,N=list(map(int, input().split()))\n\n\ni=min(N,B-1)\nprint(int(A*i/B))'] | ['Wrong Answer', 'Accepted'] | ['s443511022', 's840693876'] | [9156.0, 9128.0] | [21.0, 20.0] | [82, 70] |
p02696 | u264867962 | 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. | ['_, b, n = map(int, input().split())\n\nprint(min(b - 1, n))', 'from math import floor\n\na, b, n = map(int, input().split())\n\nx = min(b - 1, n)\n\nprint(floor(a * x / b) - a * floor(x / b))'] | ['Wrong Answer', 'Accepted'] | ['s424014065', 's509715417'] | [9072.0, 9176.0] | [25.0, 24.0] | [57, 122] |
p02696 | u267300160 | 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(1)', 'print(0)', 'print(1000000)', 'from math import floor\nA,B,N = map(int,input().split())\nx = min(B-1,N)\nprint(floor(A*x/B)-A*floor(x/B))\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s359125970', 's388074436', 's997291129', 's022174038'] | [9068.0, 9136.0, 8976.0, 9180.0] | [23.0, 23.0, 25.0, 21.0] | [8, 8, 14, 104] |
p02696 | u270886147 | 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\nif B>N:\n print(N)\nelse:\n list=(math.floor((A*N)/B)-A*(math.floor(N/B)))\n print(list)\n', 'import math\nA,B,N= map(int,input().split())\n\nif B<=N:\n lista=(math.floor((A*(B-1))/B)-A*(math.floor((B-1)/B)))\n print(lista)\nelse:\n list=(math.floor((A*N)/B)-A*(math.floor(N/B)))\n print(list)\n'] | ['Wrong Answer', 'Accepted'] | ['s271004595', 's781787148'] | [9096.0, 9028.0] | [21.0, 23.0] | [139, 204] |
p02696 | u271752889 | 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())\na=[]\nfor i in range(1,n+1):\n a.append(int(a*i/b)-5*int(i/b))\nprint(max(a))', 'a,b,n = map(int, input().split())\ni = min(n,b-1)\nprint(int(a*i/b) - a*int(i/b))'] | ['Runtime Error', 'Accepted'] | ['s308094912', 's322844661'] | [9096.0, 9020.0] | [20.0, 22.0] | [106, 79] |
p02696 | u276204978 | 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\nmx = 0\n\nif N < B:\n print(A * N)//B\nelse:\n x = (N // B) * B - 1\n print((A*x)//B - A*(x//B))', 'A, B, N = map(int, input().split())\n\nif N < B:\n print((A * N)//B)\nelse:\n x = (N // B) * B - 1\n print((A*x)//B - A*(x//B))'] | ['Runtime Error', 'Accepted'] | ['s500448826', 's510493268'] | [9172.0, 9172.0] | [26.0, 21.0] | [136, 130] |
p02696 | u277175276 | 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. | ['c=list(map(int,input().split()))\nbunsi=c[0]\nbunbo=c[1]\nn=c[2]\nk=n//bunbo\nd=[n]\nif k!=0:\n for i in range(0,k):\n d.append(bunbo*(i+1)-1)\n\ndef floor(x):\n return ((bunsi*x)//bunbo)-(bunsi*(x//bunbo))\nprint(max(floor(d[0]),floor(d[-1]),floor(d[-2])))', 'c=list(map(int,input().split()))\nbunsi=c[0]\nbunbo=c[1]\nn=c[2]\nk=n//bunbo\nd=[n]\nif k>=1:\n d.append(bunbo-1)\n d.append(bunbo*k-1)\n\ndef floor(x):\n return ((bunsi*x)//bunbo)-(bunsi*(x//bunbo))\nif len(d)>=2:\n print(max(floor(d[0]),floor(d[-1]),floor(d[-2])))\nif len(d)==1:\n print(floor(d[0]))'] | ['Runtime Error', 'Accepted'] | ['s556788937', 's660776808'] | [524228.0, 9224.0] | [2222.0, 23.0] | [300, 344] |
p02696 | u277641173 | 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_kouho=[]\ncount=1\nwhile count<=n//b:\n x_kouho.append(b*count-1)\n count+=1\nif not x_kouho:\n x_kouho.append(n)\n\nres=0\nfor i in range(0,len(x_kouho)):\n keep=x_kouho[i]\n kept=(a*keep)//b-a*(keep//b)\n if kept>res:\n res=kept\nprint(res,x_kouho)', 'a,b,n=map(int,input().split())\nx_kouho=[]\ncount=1\nif b==1:\n res=0\nelse:\n while count<=n//b:\n x_kouho.append(b*count-1)\n count+=1\n if not x_kouho:\n x_kouho.append(n)\n\n res=0\n for i in range(0,len(x_kouho)):\n keep=x_kouho[i]\n kept=(a*keep)//b-a*(keep//b)\n if kept>res:\n res=kept\nprint(res)'] | ['Wrong Answer', 'Accepted'] | ['s639557048', 's900605665'] | [343688.0, 9204.0] | [2217.0, 24.0] | [278, 315] |
p02696 | u278356323 | 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. | ["# ABC165c\nlast = 0\n\n\ndef main():\n import sys\n input = sys.stdin.readline\n sys.setrecursionlimit(10 ** 6)\n from math import floor\n \n\n def dump(*args):\n sys.stderr.write(str(args))\n\n a, b, n = map(int, input().split())\n\n def evaluate(number):\n return floor(a*number/b)-a*floor(number/b)\n if number < 100: \n return 1\n if number == 100: \n return 0\n if number > 100: \n return - 1\n\n def binary_search(low, high):\n global last\n lowest = low\n highest = high\n while low < high: \n mid = (low + high) // 2\n left = (low + mid) // 2\n right = (mid+high)//2\n lv = evaluate(left)\n rv = evaluate(right)\n mv = evaluate(mid)\n #print(low, high)\n if lv < rv:\n last = max(mv, rv)\n low = mid\n lowest = mid\n else:\n last = max(mv, lv)\n high = mid\n highest = mid\n continue\n\n if guess == 0:\n return [mid, mid]\n if guess < 0:\n high = mid - 1 \n highest = mid\n else:\n low = mid + 1 \n lowest = mid\n\n return [lowest, highest]\n\n t = binary_search(0, n + 1)[0]\n \n print(max(evaluate(t-2), evaluate(t-1), evaluate(t),\n evaluate(t+1), evaluate(t+2), last))\n\n\nif __name__ == '__main__':\n main()\n", "# ABC165c\nlast = 0\n\n\ndef main():\n import sys\n input = sys.stdin.readline\n sys.setrecursionlimit(10 ** 6)\n from math import floor\n \n\n def dump(*args):\n sys.stderr.write(str(args))\n\n a, b, n = map(int, input().split())\n\n def evaluate(number):\n return floor(a*number/b)-a*floor(number/b)\n if number < 100: \n return 1\n if number == 100: \n return 0\n if number > 100: \n return - 1\n\n def binary_search(low, high):\n global last\n lowest = low\n highest = high\n while low < high: \n mid = (low + high) // 2\n left = (low + mid) // 2\n right = (mid+high)//2\n lv = evaluate(left)\n rv = evaluate(right)\n mv = evaluate(mid)\n #print(low, high)\n if lv < rv:\n last = max(mv, rv)\n low = mid\n lowest = mid\n else:\n last = max(mv, lv)\n high = mid\n highest = mid\n continue\n\n if guess == 0:\n return [mid, mid]\n if guess < 0:\n high = mid - 1 \n highest = mid\n else:\n low = mid + 1 \n lowest = mid\n\n return [lowest, highest]\n\n t = binary_search(0, n + 1)[0]\n \n print(max(evaluate(t-2), evaluate(t-1), evaluate(max(n, t)),\n evaluate(max(n, t+1)), evaluate(max(n, t+2)), last))\n\n\nif __name__ == '__main__':\n main()\n", "# ABC165c\n\n\ndef main():\n import sys\n input = sys.stdin.readline\n sys.setrecursionlimit(10 ** 6)\n from math import floor\n \n\n def dump(*args):\n sys.stderr.write(str(args))\n\n a, b, n = map(int, input().split())\n last = -1\n ans = -1\n\n def evaluate(number):\n return floor(a * number / b) - a * floor(number / b)\n\n \n # print(i, evaluate(i))\n print(max(evaluate(min(b, n)), evaluate(min(b-1, n))))\n\n\nif __name__ == '__main__':\n main()\n"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s734073055', 's890340871', 's635632656'] | [9168.0, 9240.0, 9180.0] | [21.0, 23.0, 22.0] | [1775, 1799, 566] |
p02696 | u284155299 | 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 print(A*N//B)\nelse:\n print(A*(B-1)//B', 'A , B , N = map(int, input().split())\nprint(A*min(N,B-1)//B)'] | ['Runtime Error', 'Accepted'] | ['s171019738', 's466117930'] | [9028.0, 9140.0] | [21.0, 20.0] | [93, 60] |
p02696 | u288430479 | 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 collections import deque\nn,m,q = map(int,input().split())\nl = list(list(map(int,input().split())) for _ in range(q))\nif m<7:\n num = ["1"*n]\n k = deque(["1"*n])\n while len(k)!=0:\n h = k.popleft()\n if int(h[-1])<m:\n num.append(str(int(h)+1))\n num.append(str(int(h)+11))\n num.append(str(int(h)+111))\n k.append(str(int(h)+1))\n k.append(str(int(h)+11))\n k.append(str(int(h)+111))\n num = list(set(num))\n ma = 0\n for i in num:\n s = 0\n for a,b,c,d in l:\n if int(i[b-1])-int(i[a-1])==c:\n s += d\n ma = max(ma,s)\n print(ma)\nelse:\n l1 = sorted(l,key=lambda x:x[3])[::-1]\n print(l1[0][-1])', 'a,b,n = map(int,input().split())\nif n<b:\n answer = (a*n//b)-a*(n//b)\nelse:\n answer = (a*(b-1)//b) - a*((b-1)//b)\nprint(answer)'] | ['Runtime Error', 'Accepted'] | ['s270897248', 's312708659'] | [9412.0, 9028.0] | [24.0, 23.0] | [651, 128] |
p02696 | u289162337 | 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 = 0\ne = 1/b\nae = a*e\naxb = 0\nxb = 0\ntemp = 0\nh_cut = 0\nu_cut = 0\nfor i in range(n+1):\n axb += ae\n xb += e\n h_cut = axb-int(axb)\n u_cut = (xb-int(xb))*a\n temp = int(u_cut-h_cut)\n Max = max(Max, temp)\nelse:\n print(Max)', 'a, b, n = map(int, input().split())\nx = -1\nc = -1\nmx = 0\nwhile True:\n c += 1\n x += b\n if x > n:\n print(mx)\n break\n else:\n mx = max(mx, int(a*x/b)-a*c)', 'a, b, n = map(int, input().split())\nMax = 0\ne = 1/b\nae = a*e\naxb = 0\nxb = 0\ntemp = 0\nh_cut = 0\nu_cut = 0\nfor i in range(n):\n axb += ae\n xb += e\n h_cut = axb-int(axb)\n u_cut = (xb-int(xb))*a\n temp = u_cut-h_cut\n Max = max(Max, temp)\nelse:\n print(Max)\n', 'a, b, n = map(int, input().split())\nx = min(b-1, n)\nprint(int(a*(x)/b)-a*int(x/b))'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s237813131', 's383156574', 's803829109', 's897697247'] | [9136.0, 9016.0, 9192.0, 9164.0] | [2205.0, 2205.0, 2206.0, 23.0] | [263, 163, 257, 82] |
p02696 | u292703814 | 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(' '))\nc = min(N,B)\nif c % B == 0:\n print(int(A(c-1)/B))\nelse :\n print(int(A(c)/B))", "A,B,N = map(int, input().split(' '))\nc = min(N,B)\nif p % B == 0:\n print(int(A(c-1)/B))\nelse :\n print(int(A(c)/B))", 'import math\na, b, n = map(int, input().split())\np = min(b, n)\nif p % b == 0:\n print(int(a(p-1)/b))\nelse:\n print(int((a(p))/b))', 'import math\na, b, n = map(int, input().split())\np = min(b, n)\nif p % b == 0:\n print(int(a(p-1))/b)\nelse:\n print(int((a(p))/b))', "A,B,N = map(int, input().split(' '))\np = min(N,B)\nif p%B == 0:\n print(int(A(p-1)/B))\nelse :\n print(int(A(p)/B))", 'A,B,N = map(int, input().split())\nc = min(N,B)\nif c % B == 0:\n print(int(A*(c-1)/B))\nelse :\n print(int(A*(c)/B))'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s045910502', 's671392147', 's850556819', 's950834377', 's976103117', 's605834617'] | [9088.0, 9056.0, 9076.0, 9028.0, 9060.0, 9016.0] | [20.0, 21.0, 21.0, 20.0, 24.0, 23.0] | [119, 119, 132, 132, 117, 118] |
p02696 | u297080498 | 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\nx = B - 1\nif N < B\n x = N\na = math.floor(A * x / B) - A * math.floor(x / B)\nb = math.floor(A * N / B) - A * math.floor(N / B)\n\nif a > b:\n print(a)\nelse:\n print(b)', 'import math\n\nA, B, N= (int(x) for x in input().split())\n\nx = B - 1\nif N < B:\n x = N\na = math.floor(A * x / B) - A * math.floor(x / B)\n\nprint(a)'] | ['Runtime Error', 'Accepted'] | ['s817370646', 's961777166'] | [8844.0, 9160.0] | [22.0, 21.0] | [257, 226] |
p02696 | u297651868 | 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()))\nma=0\nfor i in range(1000000):\n ma=max((a*i/b)//1-a*((i/b)//1),ma)\n ma=max((a*(n-i)/b)//1-a*(((n-i)/b)//1),ma)\nprint(int(ma))', 'a,b,n= list(map(int, input().split()))\nma=0\nfor i in range(10000):\n ma=max(int((a*i/b)//1-a*((i/b)//1)),ma)\n ma=max(int((a*(n-i)/b)//1-a*(((n-i)/b)//1)),ma)\nprint(ma)', 'a,b,n= list(map(int, input().split()))\nif b==1:\n print(0)\n exit(0)\nma=(a*n/b)//1-a*((n/b)//1)\nfor i in range(b-1,n+1,b):\n tmp=(a*i/b)//1-a*((i/b)//1)\n ma=max(tmp,ma)\nprint(int(ma))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s500658955', 's762785461', 's794185253'] | [9192.0, 9260.0, 9192.0] | [1454.0, 38.0, 22.0] | [169, 172, 192] |
p02696 | u301679431 | 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());print(min(B-1,N))', 'A,B,N=map(int,input().split());x=min(B-1,N);print(int(A*x/B)-A*int(x/B))'] | ['Wrong Answer', 'Accepted'] | ['s235058704', 's609483701'] | [9136.0, 9108.0] | [19.0, 24.0] | [48, 72] |
p02696 | u303739137 | 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\nx = int(input())\nfinished = False\n\na = max(0,int(math.pow(x,0.2)) - 1)\nwhile a**5 - (a-1)**5 <= x:\n tmp = a**5 - x\n if tmp < 0:\n a += 1\n continue\n b = int(math.pow(tmp,0.2))\n if a**5 - b**5 == x:\n finished = True\n print(a,b)\n break\n a += 1\nif not finished:\n a = 1\n while a**5 < x:\n tmp = x - a**5\n b = int(math.pow(tmp,0.2))\n if a**5 + b**5 == x:\n finished = True\n print(a,-b)\n break\n a += 1\n ', 'val = a*n//b\nfor i in range(max(0,n//b - a), n//b):\n m = b*i - 1\n if (m > n) or (m < 0):\n continue\n else:\n val = max(val, (m*a)//b - i)\nfor i in range(max(0,n//b - a), n//b):\n m = b*i - 1\n if (m > n) or (m < 0):\n continue\n else:\n val = max(val, (m*a)//b - i)\n \nprint(val)', 'a, b, n = map(int, input().split())\nval = max(0, (a*n)//b - a*(n//b), (a*m)//b - a*(m//b), (n//b)*b-1)\nprint(val)', 'a, b, n = map(int, input().split())\nval = (a*n)//b - a*(n//b)\nval = max(val, (a*m)//b - a*(m//b))\nprint(val)', 'a, b, n = map(int, input().split())\nm = max(0,(n//b)*b-1)\nval = max((a*n)//b - a*(n//b), (a*m)//b - a*(m//b))\nprint(val)'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s070373258', 's459348253', 's619508560', 's637876076', 's115302238'] | [9092.0, 9120.0, 9100.0, 9156.0, 9056.0] | [24.0, 19.0, 25.0, 25.0, 21.0] | [543, 324, 113, 108, 120] |
p02696 | u308918401 | 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=[]\nx.append(int(a*n/b)-a*int(n/b))\nif n>=b:\n t=int(n/b)\n x.append(int(a*(t*b-1)/b)-a*int((t*b-1)/b))\nx.append(int(a*(b-1)/b)-a*int((b-1)/b))\nprint(max(x))', 'a,b,n=map(int,input().split())\nx=[]\nx.append(int(a*n/b)\nif n>=b:\n x.append(int(a*(b-1)/b)\nprint(max(x))', 'a,b,n=map(int,input().split())\nx=[]\nif n>=b:\n x.append(int(a*(b-1)/b))\nelse:\n x.append(int(a*n/b))\nprint(max(x))'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s560519140', 's576868102', 's806244368'] | [9140.0, 8940.0, 9108.0] | [20.0, 24.0, 21.0] | [189, 104, 114] |
p02696 | u311488536 | 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 = min(N,B-1)\nreturn A*x//B-A*(x//B)', 'A, B, N = map(int, input().split())\nx = min(N,B-1)\nprint(A*x//B-A*(x//B))'] | ['Runtime Error', 'Accepted'] | ['s902776922', 's489805429'] | [8984.0, 9140.0] | [23.0, 27.0] | [73, 73] |
p02696 | u315354220 | 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\nx = 0\nt = ((A * x) // B) - (A * (x // B))\nwhile x >= 0:\n x += 1\n t2 = ((A * x) // B) - (A * (x // B))\n if t2 < t:\n ans = t\n break\n t = t2\n\nprint(ans)', 'A, B, N = map(int, input().split())\n\nif N >= B:\n x = B - 1\n ans = ((A * x) // B) - (A * (x // B))\nelse:\n x = N\n ans = ((A * x) // B) - (A * (x // B))\n\n\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s752990569', 's630960482'] | [9076.0, 9124.0] | [2205.0, 21.0] | [219, 174] |
p02696 | u316733945 | 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 = max((int(a*n/b) - a * int(n/b)), (int(a*(b-1)/b) - (a * int((b-1)/b))))\n\nprint(max)', 'a, b, n = map(int, input().split())\n\nif n<b:\n print(((a*n)//b) - a * (n//b))\nelse:\n print(((a*(b-1))//b) - a * ((b-1)//b))'] | ['Wrong Answer', 'Accepted'] | ['s898731024', 's869640631'] | [9164.0, 9192.0] | [24.0, 21.0] | [126, 128] |
p02696 | u321035578 | 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 aa = min(b,n)\n for i in range(aa,n):\n\n ans = max(ans,a*aa//b - a * (aa//b))\n print(ans)\nif __name__=='__main__':\n main()\n", "def main():\n a,b,n = map(int,input().split())\n aa = min(b,n)\n ans = 0\n for i in range(aa,n):\n\n ans = max(ans,a*aa//b - a * (aa//b))\n print(ans)\nif __name__=='__main__':\n main()\n", "def main():\n a,b,n = map(int,input().split())\n aa = min(b-1,n)\n ans = a*aa//b - a * (aa//b)\n print(ans)\nif __name__=='__main__':\n main()\n"] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s535868694', 's949025977', 's244142076'] | [9152.0, 9176.0, 8956.0] | [23.0, 2205.0, 21.0] | [191, 203, 153] |
p02696 | u330690418 | 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()]\n\nm = n - n % b if n >= b else 1\n\nprint((a * m // b) - a * (m // b))\n', 'a, b, n = [int(i) for i in input().split()]\nm = b - 1 if n >= b else n\n\nprint((a * m // b) - a * (m // b))\n'] | ['Wrong Answer', 'Accepted'] | ['s690583678', 's682315460'] | [9092.0, 9164.0] | [22.0, 21.0] | [112, 107] |
p02696 | u331997680 | 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())\ndef kansu(x):\n S = floor(A*x/B)\n return S\nprint(min(kansu(N), kansu(B)))\n', 'import floor from math\nA, B, N = map(int, input().split())\ndef kansu(x):\n S = floor(A*x/B)\n return S\nprint(min(kansu(N), kansu(B)))', 'import math\nA, B, N = map(int, input().split())\ndef kansu(x):\n S = math.floor(A*x/B)\n return S\nprint(min(kansu(N), kansu(B-1)))\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s412103157', 's421190813', 's096051449'] | [9036.0, 8908.0, 9048.0] | [25.0, 23.0, 20.0] | [123, 133, 130] |
p02696 | u332317213 | 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\ninput1 = input().split()\nA = int(input1[0])\nB = int(input1[1])\nN = int(input1[2])\n\nx = 0\nresult = 0\nif N >= B-1:\n x = B-1\n result = (A*(x%B) - (A*x)%B)/B\nelif N < B-1:\n x = N\n result = (A*(x%B) - (A*x)%B)/B\n\nprint(result)', 'import math\n\ninput1 = input().split()\nA = int(input1[0])\nB = int(input1[1])\nN = int(input1[2])\n\nresult = 0\nif N >= B-1:\n result = B-1\nelif N < B-1:\n result = N\n\nprint(result)', 'import math\n\ninput1 = input().split()\nA = int(input1[0])\nB = int(input1[1])\nN = int(input1[2])\n\nx = 0\nresult = 0\nif N >= B-1:\n x = B-1\n result = (A*(x%B) - (A*x)%B)/B\nelif N < B-1:\n x = N\n result = (A*(x%B) - (A*x)%B)/B\n\nprint(int(result))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s489652443', 's930061391', 's447476298'] | [9204.0, 9080.0, 9072.0] | [21.0, 22.0, 22.0] | [246, 180, 251] |
p02696 | u332793228 | 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())\nList=[]\nfor x in range(n):\n k=math.floor((a*x)/b)-a*(math.floor(x/b))\n List.append(k)\n print(List)\nprint(List.index(max(List)))', 'a,b,n=list(map(int,input().split()))\nx=min(b-1,n)\nans=int(a*x/b)\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s991523458', 's765318714'] | [134904.0, 9044.0] | [2436.0, 24.0] | [179, 75] |
p02696 | u334703235 | 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())\nm = 0\nfor x in range((min(A,N)*100)):\n m = max(m, int(A*x/B)-A*int(x/B))\nprint(m)', 'A,B,N = map(int,input().split())\nm = 0\nif B-1 >=N:\n print(int(A*N/B)-A*int(N/B))\nelse:\n print(int(A*(B-1)/B)-A*int((B-1)/B))\n'] | ['Wrong Answer', 'Accepted'] | ['s057139204', 's638402260'] | [9168.0, 9112.0] | [2206.0, 20.0] | [117, 131] |
p02696 | u336564899 | 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())\nif n < b:\n x = n\nelse b < n:\n x = b-1\nnew = math.floor(a*x/b) - a * math.floor(x/b)\nprint(new)\n', 'import math\na, b, n = map(int, input().split())\nx = n\n\nif b <= n:\n x = b-1\n\nnew = math.floor(a*x/b) - a * math.floor(x/b)\nprint(new)\n'] | ['Runtime Error', 'Accepted'] | ['s661778446', 's615960817'] | [8884.0, 9116.0] | [20.0, 21.0] | [149, 136] |
p02696 | u338738170 | 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. | ['#int(input())\n#map(int,input().split())\n#list(map(int,input().split()))\n\na,b,n=map(int,input().split())\nl=[]\nif n>=b:\n x=b-1\nelse:\n x=n\nprint(math.floor((a*x)/b)-a*math.floor(x/b))', '#int(input())\n#map(int,input().split())\n#list(map(int,input().split()))\nimport math\na,b,n=map(int,input().split())\nl=[]\nif n>=b:\n x=b-1\nelse:\n x=n\nprint(math.floor((a*x)/b)-a*math.floor(x/b))'] | ['Runtime Error', 'Accepted'] | ['s406128477', 's499406461'] | [9108.0, 9164.0] | [22.0, 24.0] | [186, 197] |
p02696 | u349444371 | 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 if a%b!=0\n print(a-a//b -1)\n else:\n print(a-a//b)\nelse:\n print(int(n*a/b))', 'a,b,n=map(int,input().split())\n\nif b<=n:\n print(a-a//b -1)', 'a,b,n=map(int,input().split())\n\nif b<=n:\n if a%b!=0:\n print(a-a//b -1)\n else:\n print(a-a//b)\nelse:\n print(int(n*a/b))'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s759298791', 's829555910', 's209740753'] | [9016.0, 9156.0, 9044.0] | [22.0, 21.0, 20.0] | [139, 61, 140] |
p02696 | u350578302 | 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\ndef siki(A, B, X):\n\treturn math.floor((A*X)/B) - A*math.floor(X/B)\n\nA,B,N = map(int,input().split())\nx = N\nmax_value = 0\n\nfor i in range(1, B+1):\n\tif max_value < siki(A,B,i):\n\t\tmax_value = siki(A,B,i)\n\tprint(max_value)\nprint(max_value)\n', 'import math\n\ndef siki(A, B, X):\n\treturn math.floor((A*X)/B) - A*math.floor(X/B)\n\nA,B,N = map(int,input().split())\nx = N\nmax_value = 0\n\nif N < B:\n\tk = N\nelse:\n\tk = B\n\nright = N\nleft = 0\nfor i in range(1, k+1):\n\n\tmid = left + math.floor(right - left) / 2\n\tprint(mid)\n\tprint(siki(A,B,mid))\n\tif max_value > siki(A,B,mid):\n\t\tright = mid\n\telse :\n\t\tleft = mid\n\n\tif max_value < siki(A,B,mid):\n\t\tmax_value = siki(A,B,mid)\n\tprint(max_value)\n\n\nprint(max_value)\n', 'import math\n\ndef f(A, B, X):\n\treturn math.floor((A*X)/B) - A*math.floor(X/B)\n\nA,B,N = map(int,input().split())\n\nif N < B:\n\tprint(f(A,B,N))\nelse:\n\tprint(f(A,B,B-1))\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s235906311', 's244116227', 's374507600'] | [9504.0, 24924.0, 9092.0] | [2216.0, 2241.0, 21.0] | [249, 450, 164] |
p02696 | u357751375 | 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 = 0\nimax = 0\nfor i in range(1,n+1):\n x = i\n z = math.floor(a*x/b)-a*math.floor(x/b)\n if z > imax:\n imax = z\n ans = i\nprint(ans)', 'from math import floor\na,b,n = map(int,input().split())\nx = min(b-1,n)\nprint(floor(a*x/b)-a*floor(x/b))'] | ['Wrong Answer', 'Accepted'] | ['s781896329', 's327650704'] | [9188.0, 9164.0] | [2206.0, 30.0] | [199, 103] |
p02696 | u358957649 | 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 main(a,b,n):\n res = 0\n r = n // b\n for i in range(1,min(b,n)+1):\n res = max(res,calc(a,b,i))\n for i in range((r-1)*b, n+1):\n res = max(res, calc(a,b,i))\n return res\n \ndef calc(a,b,x):\n return (math.floor(a*x/b) - a * math.floor(x/b))\n\na,b,n = map(int, input().split())\nprint(main(a,b,n))', '##########\nimport math\nii = lambda:int(input())\nli = lambda:list(map(int,input().split()))\n##########\ndef main(a,b,n):\n x = min(b-1,n)\n return calc(a,b,x)\n\ndef calc(a,b,x):\n return math.floor(a*x/b) - a*math.floor(x/b)\n\na,b,n = li()\nprint(main(a,b,n))'] | ['Wrong Answer', 'Accepted'] | ['s900329247', 's903374460'] | [9148.0, 9196.0] | [2205.0, 19.0] | [338, 260] |
p02696 | u364238528 | 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. | ['temp=list(map(int,input().rstrip().split()))\na=temp[0]\nb=temp[1]\nn=temp[2]\nif (b-1)<n :\n x=(b-1)\nelse :\n x=n\nv=((a*x)//b)-(a*(x//b))\nprint v\n \n ', 'temp=list(map(int,input().rstrip().split()))\na=temp[0]\nb=temp[1]\nn=temp[2]\nif (b-1)<n :\n x=(b-1)\nelse :\n x=n\nv=((a*x)//b)-(a*(x//b))\nprint(v)'] | ['Runtime Error', 'Accepted'] | ['s781521481', 's148956316'] | [8924.0, 9144.0] | [20.0, 21.0] | [148, 143] |
p02696 | u364862909 | 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\nk = (N+1)//B\n\nprint(max(((A*B*k)-A)//B - (k-1)*A , A*N//B - A*(N//B)))\n', 'A,B,N = map(int,input().split())\n\nif B-1 >= N:\n print(((A*B)-A)//B)\nelse:\n print((A*N)//B - A*(N//B))', 'A,B,N = map(int,input().split())\n\nk = (N+1)//B\n\nprint(max(((A*B*k)-A)//B - (k-1)*A , (A*N)//B - A*(N//B)))', 'A,B,N = map(int,input().split())\n\nk = N//B\n\nprint(max(((A*B*k)-A)//B - (k-1)*A , (A*N)//B - A*(N//B)))', 'A,B,N = map(int,input().split())\n\nk = (N+1)//B\n\nprint(max( int(A*(B-1)//B) , int((A*N)//B - A*(N//B))))', 'A,B,N = map(int,input().split())\n\nif B-1 >= N:\n print(((A*B)-A)//B - A)\nelse:\n print((A*N)//B - A*(N//B))\n', 'A,B,N = map(int,input().split())\n\nk = (N+1)//B\n\nprint(max( A*(B-1)//B , (A*N)//B - A*(N//B)))', 'A,B,N = map(int,input().split())\n\nif B <= N:\n print(((A*B)-A)//B)\nelse:\n print((A*N)//B - A*(N//B))'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s011479089', 's435637394', 's466285953', 's510959665', 's515832694', 's801359794', 's975825935', 's337418342'] | [9080.0, 9168.0, 9180.0, 9172.0, 9172.0, 9032.0, 9172.0, 9168.0] | [20.0, 20.0, 23.0, 20.0, 20.0, 21.0, 19.0, 20.0] | [105, 107, 106, 102, 103, 112, 93, 105] |
p02696 | u365625186 | 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())\nbst = -100000000\n\nfor i in range(N+1):\n if((A*i)/B - A*(i/B) > bst):\n bst = (A*i)/B - A*(i/B)\n\nprint(bst)', 'A, B, N = map(int,input().split())\n \nif (N > 1):\n\tif (N < B):\n\t print((A*N)/B - A*(N/B))\n\telse:\n\t print((A*(N-1))/B - A*((N-1)/B))\nelse:\n\tprint((A*N)/B - A*(N/B))', 'import math\n\nA, B, N = map(int,input().split())\nbst = -pow(10, 10)\n\nfor i in range(N+1):\n if((floor((A*i)/B) - A*floor(i/B)) > bst):\n bst = floor((A*i)/B) - A*floor(i/B)\n\nprint(bst)', 'A,B,N = map(int, input().split())\np = min(N,B)\n\nif p%B == 0:\n print(int(A*(p-1)//B))\nelse :\n print(int(A*(p)//B))'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s182685619', 's275126393', 's659564548', 's986074803'] | [9200.0, 9184.0, 9192.0, 9200.0] | [2205.0, 19.0, 22.0, 21.0] | [150, 168, 191, 119] |
p02696 | u366963613 | 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 = list(map(int, input().split()))\nmax_value = 0\ntrial = 100000\nfor x in range(0, trial):\n x = n - x\n # print('x', x)\n tmp = (x*a//b) - a*(x//b)\n # print(x*a//b, a*(x//b))\n # print('ans', tmp)\n # print('============')\n if (tmp > max_value):\n max_value = tmp\nprint(max_value)\n", '# -*- coding: utf-8 -*-\na, b, n = list(map(int, input().split()))\nmax_value = 0\ntrial = n\n\nx = min(b-1, n)\nans = x*a//b\nans -= a*(x//b)\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s324853183', 's147179306'] | [9120.0, 9168.0] | [65.0, 22.0] | [334, 147] |
p02696 | u373190391 | 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. | ['arr = input().split(" ")\na, b, n = int(arr[0]), int(arr[1]), int(arr[2])\nif b<=n:\n k = int((a*(b-1))/b)\nelse:\n k = int((a*n)/b)\n', 'arr = input().split(" ")\na, b, n = int(arr[0]), int(arr[1]), int(arr[2])\nif b<=n:\n k = int((a*n)/b)\nelse:\n k = int((a*n)/b)', 'arr = input().split(" ")\na, b, n = int(arr[0]), int(arr[1]), int(arr[2])\nif b<=n:\n k = a\nelse:\n k = (a*((n-1))//b\nprint(k)', 'arr = input().split(" ")\na, b, n = int(arr[0]), int(arr[1]), int(arr[2])\nif b<=n:\n k = int((a*(b-1))/b)\nelse:\n k = int((a*n)/b)\nprint(k)'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s185019200', 's559062878', 's668338565', 's032163339'] | [9032.0, 9000.0, 9024.0, 9104.0] | [21.0, 23.0, 23.0, 20.0] | [132, 127, 124, 140] |
p02696 | u374671031 | 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\n\nif B >= N:\n ans = (A*(B-1))//B\nelse:\n ans = (A*(N))//B\n\nprint(ans)', 'A,B,N = map(int, input().split())\nans = 0\n\nif B <= N:\n ans = (A*(B-1))//B\nelse:\n ans = (A*(N))//B\n\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s431522720', 's491524141'] | [9184.0, 9164.0] | [22.0, 21.0] | [112, 112] |
p02696 | u385649291 | 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# Your code here!\nimport math\nline = list(map(int,input().split()))\nA,B,N =line[0],line[1],line[2]\n\nans = (N+1)//B\nif ans ==0:\n print(math.floor(A*N/B)-A*(i-1))\nelse:\n start = (math.floor(A*N/B)-A*math.floor(N/B))\n for i in range(1,ans+1):\n x= i*B-1\n start = max((math.floor(A*x/B)-A*(i-1)),start)\n print(start)', '# coding: utf-8\n# Your code here!\ndef main():\n import sys\n line = sys.stdin.readline\n A,B,N = map(int,input().split())\n if B>N:\n ans = A*N//B\n else:\n ans = A*(B-1)//B\n print(ans)\n\nif __name__== "__main__":\n main()\n'] | ['Runtime Error', 'Accepted'] | ['s193701489', 's691677398'] | [9216.0, 9048.0] | [2205.0, 23.0] | [353, 249] |
p02696 | u387080888 | 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())\na,b,x=0,0.1,0\nwhile b>a:\n a=math.floor(A*x/B)-A*math.floor(x/B)\n b=math.floor(A*(x+1)/B)-A*math.floor((x+1)/B)\n x+=1\nif N<=x:\n print(math.floor(A*N/B)-A*math.floor(N/B))\nelse:\n print(a)', 'A,B,N=map(int,input().split())\nc=min(B-1,N)\nprint(int((A*c-A*c%B)/B))'] | ['Wrong Answer', 'Accepted'] | ['s595011658', 's035254589'] | [9088.0, 9140.0] | [27.0, 20.0] | [243, 69] |
p02696 | u391731808 | 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 = ((A*N)//B) - A * (N//B)\nif B-1 >= N:\n tmp = ((A*(B-1))//B) - A * ((B-1)//B)\n ans = max(ans,tmp)\nprint(ans)', 'A,B,N = map(int,input().split())\nans = ((A*N)//B) - A * (N//B)\nif B-1 <= N:\n tmp = ((A*(B-1))//B) - A * ((B-1)//B)\n ans = max(ans,tmp)\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s620508055', 's735916984'] | [9180.0, 9124.0] | [21.0, 21.0] | [151, 151] |
p02696 | u393253137 | 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 cal(i):\n return floor(a*i/b)-a*floor(i/b)\nfrom math import floor\na, b, n = map(int, input().split())\nif b-1<n:\n ans = cal(b-1)\nprint(max(cal(ans), cal(0),cal(n)))', 'a, b, n = map(int, input().split())\ndef cal(x):\n return (a*x)//b - a*(x//b)\nprint(cal(min(b-1,n)))'] | ['Runtime Error', 'Accepted'] | ['s705273307', 's795337561'] | [9124.0, 9164.0] | [22.0, 23.0] | [173, 101] |
p02696 | u395816772 | 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\nc = b-1\n\nans = math.floor(a * c /b) - a * floor(c/b)\n\nprint(ans)', 'import math\na,b,n = map(int, input().split())\nif b > n:\n c = n\nelse:\n c = b-1\nans = math.floor(a * c /b) - a * math.floor(c/b)\n\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s343548947', 's509426070'] | [9168.0, 9136.0] | [25.0, 23.0] | [111, 144] |
p02696 | u396210538 | 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 sys import stdin\n \nA, B, N = [int(x) for x in stdin.readline().rstrip().split()]\n \nans1 = int((A*N)/B)-A*(N/B)\n \nif B-1<=N:\n\tans2 = (A*(B-1))//B\nelse:\n \tans2=0\n \nprint(max(ans1,ans2))', 'from sys import stdin\nimport sys\n \nA, B, N = [int(x) for x in stdin.readline().rstrip().split()]\n# N, M = [int(x) for x in stdin.readline().rstrip().split()]\n# U = input().split()\nans = int((A*N)/B)-A*int(N/B)\nif B-1<=N:\n\tans2 = int((A*(B-1))/B)-A*int((B-1)/B)\nelse:\n \tans2=0\n\nprint(ans2)\n', 'from sys import stdin\n \nA, B, N = [int(x) for x in stdin.readline().rstrip().split()]\n \nans1 = ((A*N)//B)-A*int(N/B)\n \nif B-1<=N:\n\tans2 = (A*(B-1))//B\nelse:\n \tans2=0\n \nprint(max(ans1,ans2))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s582447660', 's945097405', 's773268847'] | [9084.0, 9088.0, 9160.0] | [21.0, 23.0, 20.0] | [189, 290, 190] |
p02696 | u401487574 | 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. | ['comb = []\ndef f(n,cnt,ls):\n if cnt == n:\n comb.append(ls)\n return\n for i in range(ls[cnt-1],m+1):\n tmp = ls.copy()\n tmp[cnt] = i\n f(n,cnt+1,tmp)\n return\nma = lambda :map(int,input().split())\nni = lambda:int(input())\n\nn,m,q = ma()\nabcd = []\nfor i in range(q):\n abcd.append(list(ma()))\nls = [1]*(n+1)\nf(n,0,ls)\nans = 0\nfor A in comb:\n tmp = 0\n for a,b,c,d in abcd:\n if A[b-1] - A[a-1] ==c:\n tmp +=d\n ans = max(ans,tmp)\nprint(ans)\n', 'import collections\nimport math\nimport itertools\nimport sys\nsys.setrecursionlimit(10**6)\ndef f(x):\n return (a*x)//b - a*(x//b)\nma = lambda :map(int,input().split())\nni = lambda:int(input())\na,b,n = ma()\nif n>=b-1:\n print(f(b-1))\nelse:\n print(f(n))\n'] | ['Runtime Error', 'Accepted'] | ['s633854848', 's409714820'] | [9148.0, 9464.0] | [23.0, 28.0] | [503, 254] |
p02696 | u401686269 | 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,N,B=map(int, input().split())\n\nif N < B:\n x = N\nelse:\n x = B-1\n\nprint(int(A*x/B) - A*int(x/B))', 'A,B,N=map(int, input().split())\n\nif A == 1: print(0)\nelif B == 1: print(0)\n\nelse:\n if N ==1: x=1\n elif N < B: x = N\n else:x = B-1\n print(int(A*x/B) - A*int(x/B))'] | ['Wrong Answer', 'Accepted'] | ['s483912946', 's617457368'] | [9124.0, 9020.0] | [26.0, 27.0] | [98, 165] |
p02696 | u404629709 | 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 n<b:\n ans=int(a*n/b)-a*int(n/b)\nelse :\n ans=int(a*(n-1)/b)-a*int((n-1)/b)\n', 'a,b,n=map(int,input().split())\n\nif n<b:\n ans=int(a*n/b)-a*int(n/b)\nelse:\n ans=int(a*(b-1)/b)-a*int((b-1)/b)\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s660982867', 's772041577'] | [9116.0, 9040.0] | [23.0, 23.0] | [111, 120] |
p02696 | u405483159 | 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\nmin_num = 1\nmax_num = N\n\ndef func( x ):\n return math.floor( A * x / B ) - A * math.floor( x / B )\n \nret = 0\nwhile True:\n a = math.ceil( ( max_num + min_num ) / 2 )\n if func( max_num ) - func( min_num ):\n min_num = a\n else:\n max_num = a\n if max_num == min_num:\n break\n\nprint( func( a ))\n \n', 'import math\nA, B, N = map( int, input().split() )\n \nmin_num = 1\nmax_num = N\n \ndef func( x ):\n return math.floor( A * x / B ) - A * math.floor( x / B )\n \nret = 0\nwhile True:\n a = math.ceil( ( max_num + min_num ) / 2 )\n if func( min_num ) - func( max_num ) >= 0:\n min_num = a\n else:\n max_num = a\n if func( max_num ) == func( min_num ):\n break\n \nprint( func( a ))', 'import math\nA, B, N = map( int, input().split() )\n\ndef func( X ):\n return math.floor( A * X / B ) - A * math.floor( X / B )\n\nprint( func( min( B - 1, N ) ) )'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s537110416', 's949510357', 's561798508'] | [9180.0, 9132.0, 9104.0] | [2205.0, 2205.0, 20.0] | [356, 375, 159] |
p02696 | u408544110 | 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#include <cstdio>\n#include <algorithm>\n\n\n#include <map>\n#include <list>\n\n#include <cstring>\n#include <cstdlib>\n#include <ctime>\n#include <cmath>\n#include <stack>\n#pragma GCC optimize(3 , "Ofast" , "inline")\nusing namespace std ;\ntypedef long long ll ;\nconst double esp = 1e-6 , pi = acos(-1) ;\ntypedef pair<int , int> PII ;\nconst int N = 1e5 + 10 , INF = 0x3f3f3f3f , mod = 1e9 + 7;\nll in()\n{\n ll x = 0 , f = 1 ;\n char ch = getchar() ;\n while(!isdigit(ch)) {if(ch == \'-\') f = -1 ; ch = getchar() ;}\n while(isdigit(ch)) x = x * 10 + ch - 48 , ch = getchar() ;\n return x * f ;\n}\nint main()\n{\n ll a = in() , b = in() , n = in() ;\n ll l = 0 , r = n , ans = 0 ;\n while(l < r)\n {\n ll mid = l + r + 1 >> 1 ;\n if((a * mid) / b - a * (mid / b) >= ans) l = mid ;\n else r = mid - 1 ;\n }\n cout << (a * r) / b - a * (r / b) << endl ;\n return 0 ;\n}\n/*\n*/\n', 'a , b , n = map(int , input().split())\nl = 0\nr = n\nans = 0\nwhile (l < r) :\n mid = (l + r + 1) // 2\n if (a * mid) // b - a * (mid // b) >= ans :\n ans = (a * mid) // b - a * (mid // b)\n l = mid\n else :\n r = mid - 1\nprint((a * r) // b - a * (r // b))'] | ['Runtime Error', 'Accepted'] | ['s977654902', 's495346558'] | [9008.0, 9136.0] | [24.0, 22.0] | [944, 281] |
p02696 | u408620326 | 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 import sys\n import math\n sys.setrecursionlimit(10 ** 6)\n input = sys.stdin.readline\n A, B, N = [int(x) for x in input().strip().split()]\n ans = 0\n for x in range(N, N-A-1, -1):\n ans = max(ans, math.floor((A*x)/B)-A*math.floor(x/B), 0)\n \n print(ans)\n\n\nif __name__ == '__main__':\n main()", "def main():\n import sys\n import math\n sys.setrecursionlimit(10 ** 6)\n input = sys.stdin.readline\n A, B, N = [int(x) for x in input().strip().split()]\n ans = 0\n for x in range(min(N, B), max(min(N, B)-A-1, -1), -1):\n ans = max(ans, math.floor((A*x)/B)-A*math.floor(x/B), 0)\n \n print(ans)\n\n\nif __name__ == '__main__':\n main()"] | ['Wrong Answer', 'Accepted'] | ['s598168674', 's949870836'] | [9172.0, 9204.0] | [600.0, 598.0] | [335, 360] |
p02696 | u411353821 | 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\ndef main():\n A, B, N = map(int, input().split())\n x = max(B - 1, N)\n print(floor(A*x/B) - A*floor(x/B))\nif __name__ == "__main__":\n main()', "from math import floor\n\n\ndef main():\n A, B, N = map(int, input().split())\n if N >= B-1:\n x = B - 1\n else:\n x = N\n\n print(floor((A*x)/B) - A*floor(x/B))\n\n\nif __name__ == '__main__':\n main()\n"] | ['Wrong Answer', 'Accepted'] | ['s477877424', 's449324717'] | [9168.0, 9100.0] | [22.0, 23.0] | [173, 218] |
p02696 | u411858517 | 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 i in range(10 ** 6):\n print(A * i // B - A * (i // B))\n ans = max(ans, A * i // B - A * (i // B))\n\nfor i in range(10 ** 6):\n i = N - i\n if i < 0:\n break\n ans = max(ans, A * i // B - A * (i // B))\n\nprint(ans)', 'A, B, N = map(int, input().split())\n\nans = 0\nfor i in range(10 ** 5):\n print(A * i // B - A * (i // B))\n ans = max(ans, A * i // B - A * (i // B))\n\nprint(ans)', 'A, B, N = map(int, input().split())\n\nans = 0\nfor i in range(10 ** 6):\n ans = max(ans, A * i // B - A * (i // B))\n\nfor i in range(10 ** 6):\n i = N - i\n if i < 0:\n break\n ans = max(ans, A * i // B - A * (i // B))\n\nprint(ans)', 'A, B, N = map(int, input().split())\n\nans = 0\nfor i in range(10 ** 5):\n ans = max(ans, A * i // B - A * (i // B))\n\nfor i in range(10 ** 5):\n i = N - i\n ans = max(ans, A * i // B - A * (i // B))\n\nprint(ans)', 'A, B, N = map(int, input().split())\n\nans = 0\nfor i in range(10 ** 5):\n ans = max(ans, A * i // B - A * (i // B))\n\nprint(ans)', 'A, B, N = map(int, input().split())\n\nans = 0\nfor i in range(10 ** 8):\n print(A * i // B - A * (i // B))\n ans = max(ans, A * i // B - A * (i // B))\n\nfor i in range(10 ** 8):\n i = N - i\n if i < 0:\n break\n ans = max(ans, A * i // B - A * (i // B))\n\nprint(ans)', 'A, B, N = map(int, input().split())\n\nans = 0\nfor i in range(10 ** 7):\n print(A * i // B - A * (i // B))\n ans = max(ans, A * i // B - A * (i // B))\n\nfor i in range(10 ** 7):\n i = N - i\n if i < 0:\n break\n ans = max(ans, A * i // B - A * (i // B))\n\nprint(ans)', 'A, B, N = map(int, input().split())\n\nans = 0\nfor i in range(10 ** 5):\n ans = max(ans, A * i // B - A * (i // B))\n\nfor i in range(10 ** 5):\n i = N - i\n if i < 0:\n break\n ans = max(ans, A * i // B - A * (i // B))\n\nprint(ans)', 'A, B, N = map(int, input().split())\n\ndef solve(i):\n return A * i // B - A * (i // B)\n\nprint(solve(min(B-1, N)))'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Wrong Answer', 'Accepted'] | ['s208619290', 's283251530', 's323548311', 's379006594', 's447871581', 's470104249', 's701867126', 's909941023', 's330037222'] | [9264.0, 9300.0, 9196.0, 9172.0, 9144.0, 16824.0, 17168.0, 9196.0, 9160.0] | [1385.0, 112.0, 948.0, 108.0, 61.0, 2221.0, 2221.0, 109.0, 24.0] | [264, 160, 229, 207, 125, 264, 264, 229, 112] |
p02696 | u416011173 | 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\nimport math\nimport numpy as np\n\n\nA, B, N = list(map(int, input().split()))\n\n\n\n\ndef func(x: np.ndarray) -> np.ndarray:\n return np.floor(A*x/B) - A*np.floor(x/B)\n\n\nresult = 0\nx = np.arange(min(N, B-1), (N//2)+1, B)\nx = func(x)\nresult = max(result, int(np.max(x)))\nx = np.arange((N//2), N+1, B)\nx = func(x)\nresult = max(result, int(np.max(x)))\n\n\n\nprint(result)\n', '# -*- coding: utf-8 -*-\n\nimport math\nimport numpy as np\n\n\nA, B, N = list(map(int, input().split()))\n\n\n\n\ndef func(x: np.ndarray) -> np.ndarray:\n return np.floor(A*x/B) - A*np.floor(x/B)\n\n\nresult = 0\nx = np.arange(min(N, B-1), (N//2)+1, B)\nx = func(x)\nresult = max(result, int(np.max(x)))\nx = np.arange((N//2), N+1, B)\nx = func(x)\nresult = max(result, int(np.max(x)))\n\n\n\nprint(int(np.max(x)))\n', '# -*- coding: utf-8 -*-\n\nimport math\n\n\nA, B, N = list(map(int, input().split()))\n\n\ndef f(x: int) -> int:\n \n return math.floor(A*x/B) - A*math.floor(x/B)\n\n\ndef main() -> None:\n """Entry point\n """\n \n \n result = f(min(B-1, N))\n\n \n print(result)\n\n\nif __name__ == "__main__":\n main()\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s164961186', 's400155845', 's816823304'] | [27060.0, 27224.0, 9116.0] | [107.0, 109.0, 20.0] | [472, 480, 758] |
p02696 | u425317134 | 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. | ['(defun calc (x a b n)\n (- (floor (/ (* a x) b))\n (* a (floor (/ x b)))))\n\n(let ((a (read))\n (b (read))\n (n (read)))\n (format t "~A" (if (<= b n)\n (calc (1- b) a b n)\n (calc n a b n))))\n', 'a, b, n = map(int, input().split())\n\nif b < n:\n x = b-1\nelif b == n:\n x = b-1\nelse:\n x = n\n\nprint(int(a*x/b) - a*int(x/b))\n'] | ['Runtime Error', 'Accepted'] | ['s904227617', 's955828337'] | [8940.0, 9160.0] | [24.0, 23.0] | [250, 126] |
p02696 | u425762225 | 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 - int(a*min(B-1,N)/B)\nprint(max)\n~ ', 'A, B, N = map(int,input().split())\n\nmax = int(A*min(B-1,N)/B)\nprint(max) '] | ['Runtime Error', 'Accepted'] | ['s925978634', 's820943365'] | [8920.0, 9028.0] | [22.0, 21.0] | [87, 83] |
p02696 | u430223993 | 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.arange(1, b+1)\ny = np.floor(a * x / b) - a * np.floor(x / b)\nprint(y)\nprint(int(y.max()))', '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'] | ['s358453532', 's099948542'] | [27332.0, 9164.0] | [105.0, 20.0] | [151, 118] |
p02696 | u434296044 | 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. | ['x=int(input())\n\nfor i in range(1,120):\n for j in range(-120,120):\n if ((i**5)-(j**5))==x:\n print(i, j)\n exit()\n', 'A,B,N=map(int,input().split())\n\nx=min(N,B-1)\n\nans=((A*x)//B)-(A*(x//B))\nprint(ans)\n\n\n'] | ['Runtime Error', 'Accepted'] | ['s275771106', 's374355135'] | [9148.0, 9104.0] | [26.0, 19.0] | [143, 85] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.