QOJ.ac
QOJ
ID | 提交记录ID | 题目 | Hacker | Owner | 结果 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|
#994 | #634409 | #9456. Numbers | hos_lyric | ucup-team4967 | Success! | 2024-10-14 17:29:53 | 2024-10-14 17:29:53 |
詳細信息
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 | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#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)