You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
646 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#include <bits/stdc++.h>
//https://www.luogu.com.cn/blog/x4Cx58x54/solution-p2638
//经典题
using namespace std;
typedef unsigned long long ULL;
int n, a, B;
ULL ans;
//求组合数的优化后办法
//优点从1开始除和乘可以防止过早溢出和除法除不尽
ULL C(int n, int m) {
ULL sum = 1;
for (int i = 1; i <= m; i++)
sum = sum * (n - m + i) / i;
return sum;
}
int main() {
cin >> n >> a >> b;
for (int i = 0; i <= a; i++)
for (int j = 0; j <= b; j++)
ans += C(n + i - 1, n - 1) * C(n + j - 1, n - 1);
cout << ans << endl;
return 0;
}