第20650题 单选题
下列关于两种阶乘计算实现方式的说法正确的是?

给出两种阶乘计算的C++实现如下:

int factorial1(int n) {
    if (n <= 1) return 1;
    return n * factorial1(n - 1);
}

int factorial2(int n) {
    int acc = 1;
    while (n > 1) {
        acc = n * acc;
        n = n - 1;
    }
    return acc;
}
{{ option.label }}
子题{{ index + 1 }} {{ child.type_label }}
{{ option.label }}
✓ 正确 ◐ 部分正确 ✗ 错误
程序运行统计
暂无判题统计
提交{{ questionInfo.stats ? questionInfo.stats.submit_count : 0 }}次 正确率{{ statsAccuracy }}%
答案解析