QOJ.ac
QOJ
ID | Submission ID | Problem | Hacker | Owner | Result | Submit time | Judge time |
---|---|---|---|---|---|---|---|
#994 | #634409 | #9456. Numbers | hos_lyric | ucup-team4967 | Success! | 2024-10-14 17:29:53 | 2024-10-14 17:29:53 |
Details
Extra Test:
Time Limit Exceeded
input:
20000 0 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 1 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 2 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999...
output:
0 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 ...
result:
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#634409 | #9456. Numbers | ucup-team4967# | TL | 811ms | 10620kb | Python3 | 299b | 2024-10-12 17:15:40 | 2024-10-14 17:30:26 |
answer
t = int(input())
for i in range(t):
n, m = list(map(int, input().split()))
ans = 0
pp = 1 << 3500
for k in range(3500, -1, -1):
if (pp - 1) * m < n:
ans += pp
cnt = min(m, n // pp)
n -= cnt * pp
pp >>= 1
print(ans)