数的分解
类型:程序题

题目说明

def fun(x, y=2):
    if x == 1:
        global ans
        ①
    for i in range(y, x+1):
        if         ②        :
            fun(x//i,i)
lst = [2, 8, 9, 20] #测试数据
for i in lst:
    ans = 0
    ③
    print(ans)

程序运行结果如下:

1

3

2

4

评分标准

  1. ans += 1(2分)

  2. x % i == 0(3分)

  3. fun(i(3分)

代码编辑器 加载中...
留空使用题目默认限制
{{resultStatus.text}}
正在加载运行记录...
乐编题库AI助手
人工客服
微信扫码联系客服
历史对话
{{ s.title || '未命名对话' }}
{{ s.created_at }}
暂无历史对话
我能帮助你什么?