第20319题 判断题
判断用迭代递推方式计算斐波那契数列第n项的C++程序时间复杂度是否为O(2ⁿ)
int fib(int n) {
 if (n <= 1) return n;
 int f0 = 0, f1 = 1, cur = 0;
 for (int i = 2; i <= n; i++) {
  cur = f0 + f1;
  f0 = f1;
  f1 = cur;
 }
 return cur;
}
{{ option.label }}
子题{{ index + 1 }} {{ child.type_label }}
{{ option.label }}
✓ 正确 ◐ 部分正确 ✗ 错误
程序运行统计
暂无判题统计
提交{{ questionInfo.stats ? questionInfo.stats.submit_count : 0 }}次 正确率{{ statsAccuracy }}%
答案解析