第22961题 判断题
判断下列C++代码是否可以正确计算「从第3项起为前两项之和」规律的数列的第N项(N>2)
int start1; // 第1个数
int start2; // 第2个数
int N; //求N个数的值
int tmp;
cin >> start1 >> start2 >> N;

for (int i = 2; i < N; i++){
    tmp = start1 + start2;
    start1 = start2;
    start2 = tmp;
}
cout << start2;
{{ option.label }}
子题{{ index + 1 }} {{ child.type_label }}
{{ option.label }}
✓ 正确 ◐ 部分正确 ✗ 错误
程序运行统计
暂无判题统计
提交{{ questionInfo.stats ? questionInfo.stats.submit_count : 0 }}次 正确率{{ statsAccuracy }}%
答案解析