Skip to content

Instantly share code, notes, and snippets.

@sifatshishir
Created February 18, 2018 16:08
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define Min(a,b) (a<=b)? a : b
ll nCr(ll n, ll r)
{
if (r==0) return 1;
else return nCr(n-1,r-1) * n / r;
}
int main()
{
ll n,r,m;
while (cin >> n >> r)
{
cout << nCr(n, Min(r, n-r)) << endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment