第19466题 程序题
分析C++递归程序,计算指定输入对应的输出结果

阅读程序填写结果:

#include <cstdio>
#include <iostream>
using namespace std;
int fun(int x) {
    if(x == 0 || x == 1)
        return 3;
    else
        return x + fun(x-2);
}
int main() {
    int k;
    cin >> k;
    printf("%d", fun(k));
    return 0;
}
题号 第1题 第2题 第3题
输入数据 1 3 9
输出数据
{{ option.label }}
子题{{ index + 1 }} {{ child.type_label }}
{{ option.label }}
✓ 正确 ◐ 部分正确 ✗ 错误
编辑模式
程序运行统计
暂无判题统计
提交{{ questionInfo.stats ? questionInfo.stats.submit_count : 0 }}次 正确率{{ statsAccuracy }}%
答案解析