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