第六题(NOIP2011)
#include<iostream>
using namespace std;
int n;
void f2(int x, int y);
void f1(int x, int y) {
if (x < n)
f2(y, x + y);
}
void f2(int x, int y) {
cout << x << " ";
f1(y, x + y);
}
int main() {
cin >> n;
f1(0, 1);
return 0;
}
- 【判断题】把第4行删除,程序不会出现编译错误。
{{ select(1) }}
- 【判断题】输入为10,输出为1 2 5。
{{ select(2) }}
- 【判断题】把第7行的
x < n改为x <= n,程序运行结果会出现改变。
{{ select(3) }}
- 【判断题】该程序的时间复杂度为O(n)。
{{ select(4) }}
- 【选择题】当输入为35时,输出为( )。
{{ select(5) }}
- 1 2 5 13 34
- 1 2 5 13
- 1 2 13
- 2 5 13
- 【选择题】输出为1 2 5时,n的值可以为( )。
{{ select(6) }}