fork(4) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int K;
  4. int rec(int i)
  5. {
  6. if(i<0)return 0;
  7. if(i==2 || i==0)return 1;
  8. int ANS = 0;
  9. for(int c=0; c<=K; c+=2)
  10. {
  11. if ((i-2-c)<0)break;
  12. ANS += rec(c)*rec(i-2-c);
  13. }
  14. return ANS;
  15. }
  16.  
  17. int main()
  18. {
  19. K=8;
  20. /*Part (a)*/
  21. cout<<rec(2*6)<<endl;
  22. K=4;
  23. /*Part (b) */
  24. cout<<rec(2*8)<<endl;
  25. /*Part (c)*/
  26. cout<<rec(2*10)<<endl;
  27. return 0;
  28. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
90
146
585