Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #define LD long double
- using namespace std;
- LD Comb(int n,int m)
- {
- LD cnk=1;
- int i=0;
- for(int k=1;k<=m;++k)
- {
- cnk=cnk*(n-k+1)/k;
- while(cnk>=1&&i<n)
- cnk/=2,++i;
- }
- for(int k=i+1;k<=n;++k)
- cnk/=2;
- return cnk;
- }
- int main()
- {
- int n,m;
- cin>>n>>m;
- cout<<Comb(n+m-2,n-1);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement