fork download
  1. #include <stdio.h>
  2.  
  3. int T(int n);
  4.  
  5. int main(void) {
  6. int n=4,re;
  7. re=T(n);
  8. printf("%d",re);
  9.  
  10. }
  11.  
  12. int T(int n){
  13.  
  14. switch(n){
  15. case 0:
  16. return 0;
  17.  
  18. case 1:
  19. case 2:
  20.  
  21. return 1;
  22.  
  23. default:
  24.  
  25. return T(n - 1) + T(n - 2) + T(n - 3);
  26.  
  27. }
  28.  
  29. }
Success #stdin #stdout 0.01s 5328KB
stdin
Standard input is empty
stdout
4