#444. CSP-J模拟套题2-16
CSP-J模拟套题2-16
- (阅读程序)
#include <iostream>
using namespace std;
int cnt=0;
int f(int x=1,int y=2)
{
if(x==0)
{
cnt++;
return y;
}
return f(x-1,y-1)+f(x-1);
}
int main()
{
ios::sync_with_stdio(false); cin.tie(0);
cout<<f(3,3)<<'\n';
cout<<cnt;
}
(判断题)
求 f 函数时间复杂度为 O(N)。( )
{{ select(1) }}
- 对
- 错
这段代码无法编译通过,因为 f(x - 1) 缺少了一个变量。( )
{{ select(2) }}
- 对
- 错
这段代码中 f 函数被调用了 16 次。( )
{{ select(3) }}
- 对
- 错
程序输出的第一个数字是 10。( )
{{ select(4) }}
- 对
- 错
(选择题)
程序输出的第二个数字为( )
{{ select(5) }}
- 8
- 10
- 12
- 14
f(4 , 3) 是多少?( )
{{ select(6) }}
- 16
- 17
- 18
- 19
相关
在下列比赛中: