第26767题 判断题
判断以下Python代码能否正确输出指定格式的各数质因数列表

预期输出形如:{5: [5], 6: [2, 3], 7: [7], 8: [2, 2, 2]} 对应代码如下:

n, m = map(int, input().split())
if n > m:
    n, m = m, n
prime_factor = {} # 保存每个数的质因数
for i in range(n, m + 1):
    j, k = 2, i
    while k != 1:
        if k % j == 0:
            prime_factor[i] = prime_factor.get(i, []) + j
            k //= j
            continue
        j += 1
print(prime_factor)
{{ option.label }}
子题{{ index + 1 }} {{ child.type_label }}
{{ option.label }}
✓ 正确 ◐ 部分正确 ✗ 错误
程序运行统计
暂无判题统计
提交{{ questionInfo.stats ? questionInfo.stats.submit_count : 0 }}次 正确率{{ statsAccuracy }}%
答案解析