fork(46) download
  1. #include <stdio.h>
  2.  
  3. int foo(int n,int r)
  4. {
  5. if(n==r) return 1;
  6. if(r==1) return n;
  7. return foo(n-1,r) + foo(n-1,r-1);
  8. }
  9.  
  10. int main()
  11. {
  12. int n,r;
  13. scanf("%d %d",&n,&r);
  14.  
  15. printf("%d",foo(n,r));
  16. return 0;
  17. }
Success #stdin #stdout 0.01s 1680KB
stdin
7 4
stdout
35