Skip to content

Commit 91ac962

Browse files
authored
Create combinatorics.
1 parent 70aff89 commit 91ac962

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

combinatorics.

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
//Author: Fuadul Hasan([email protected])
2+
//BSMRSTU,Gopalganj
3+
#include<bits/stdc++.h>
4+
using namespace std;int tc = 1;
5+
#define happy ios::sync_with_stdio(false);
6+
#define coding cin.tie(0);
7+
#define pb push_back
8+
#define mp make_pair
9+
#define ll long long
10+
#define pr pair<int, int>
11+
#define vpr vector<pr>
12+
#define vi std::vector<int>
13+
#define vll std::vector<ll>
14+
#define all(n) n.begin(),n.end()
15+
#define Test printf("Case %d: ",tc++);
16+
#define YES printf("YES\n");
17+
#define NO printf("NO\n");
18+
#define Yes printf("Yes\n");
19+
#define No printf("No\n");
20+
const int mod = 1e9 + 7;
21+
const ll Inf = (ll)2e18 + 5;
22+
const int N = 2e5 + 5;
23+
24+
ll comb[31][31];
25+
26+
ll nCr(ll n,ll r){
27+
if(r>n) return 0LL;
28+
if(r==0||n==r) return 1LL;
29+
if(comb[n][r]) return comb[n][r];
30+
return comb[n][r] = nCr(n-1,r)+nCr(n-1,r-1);
31+
}
32+
33+
/*ll nCr(ll n,ll r){
34+
ll ans =1, t = 1;
35+
if(n<r) return 0;
36+
for(ll i = n;i>r;i--){
37+
ans*=i;
38+
ans/=t++;
39+
}
40+
return ans;
41+
}*/
42+
43+
int solve()
44+
{
45+
//happy coding
46+
ll a,b,c;
47+
cin>>a>>b>>c;
48+
49+
//combination..
50+
ll cele = 4;
51+
ll sum = 0;
52+
while(c-cele>=1){
53+
if(cele<=a&&c-cele<=b)
54+
sum += nCr(a,cele)*nCr(b,c-cele);
55+
//cout<<sum<<endl;
56+
cele++;
57+
}
58+
//ll sum = combination(30,4,30,26);
59+
60+
cout<<sum<<endl;
61+
62+
return 0;
63+
}
64+
int main(){
65+
int test = 1;
66+
//scanf("%d", &test);
67+
while (test--)solve();return 0;
68+
}

0 commit comments

Comments
 (0)