C. [GESP]L5-202409-Q2634-S
[GESP]L5-202409-Q2634-S
该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。
对下面两个函数,说法错误的是( )。
int sumA(int n) {
int res = 0;
for (int i = 1; i <= n; i++) {
res += i;
}
return res;
}
int sumB(int n) {
if (n == 1)
return 1;
int res = n + sumB(n - 1);
return res;
}
{{ select(1) }}
- sumA 体现了迭代的思想。
- SumB 采用的是递归方式。
- SumB 函数比 SumA 的时间效率更高。
- 两个函数的实现的功能相同。
GESP 2024.09 C++ 五级 全真模拟赛
- 状态
- 已结束
- 规则
- OI
- 题目
- 27
- 开始于
- 2026-11-20 13:30
- 结束于
- 2026-11-25 13:30
- 持续时间
- 2 小时
- 主持人
- 参赛人数
- 0