fork(1) download
  1. #include <stdio.h>
  2. int trb(int x)
  3. {
  4. if(x==0)
  5. return 0;
  6. else if(x==1)
  7. return 0;
  8. else if(x==2)
  9. return 1;
  10. else
  11. return trb(x-1)+trb(x-2)+trb(x-3);
  12. }
  13.  
  14. int main(void) {
  15. int n;
  16. scanf("%d",&n);
  17. printf("%d\n",trb(n));
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0.01s 5328KB
stdin
10
stdout
81