Advertisement
SergeyPGUTI

6.2.5

Nov 20th, 2015
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.24 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. int Cnk(int n,int k)
  7. {
  8.     if (k==0 || n==k) return 1;
  9.     else
  10.     return Cnk(n-1,k-1)+Cnk(n-1,k);
  11. }
  12.  
  13. int main()
  14. {
  15.     int n,k;
  16.     cin>>n>>k;
  17.     cout<<Cnk(n,k);
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement