QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#809232 | #9864. Coin | hsn | Compile Error | / | / | C++23 | 642b | 2024-12-11 13:24:47 | 2024-12-11 13:24:49 |
Judging History
This is the latest submission verdict.
- [2024-12-11 13:24:49]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2024-12-11 13:24:47]
- Submitted
answer
import math
def find_last_ans(n, k):
if k > n / 2:
return n
c = k - 1
ans = 1
last_ans = 1
while ans <= n:
m = math.ceil(ans / c)
next_multiple = math.ceil(ans / c) * c
s = min((next_multiple - ans - 1) // m + 1, (n - ans) // m)
if s <= 0:
if ans + m <= n:
ans += m
last_ans = ans
else:
break
else:
ans += s * m
last_ans = ans
return last_ans
t = int(input())
for _ in range(t):
n, k = map(int, input().split())
print(find_last_ans(n, k))
Details
answer.code:1:1: error: ‘import’ does not name a type 1 | import math | ^~~~~~ answer.code:1:1: note: C++20 ‘import’ only available with ‘-fmodules-ts’, which is not yet enabled with ‘-std=c++20’