当不满足递归条时return用来结束递归
#include<iostream>using namespace std;int sum=0;void f(int n,int k){ if(n<0)return;//非常有必要 if(n==0) { if(k%2==0)sum++; }
f(n-1,k+1); f(n-2,k+1);}int main(){ f(39,0); cout<<sum<<endl; return 0;}