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