0
0
已采纳
0
0
if(x<=2)
return 1;
if(x==3)
return 2;
return s(x-3)+s(x-1);
递归式
s[1]和s[2]都是1
s[3]是2
根据实验 递归式:s[x-3]+s[x-1];
0
int fb(int m)
{
if(m<=2)
return 1;
return fb(m-3)+fb(m-1);
}
int main()
{
int m,num;
cin>>m;
num=fb(m);
cout<<num;
}
0
0