Total Submission(s): 444 Accepted Submission(s): 77
Description
最近LG的RP爆发,准备买注彩票,而他正好找到了一种看起来不错的彩票。
这种彩票需要从1到i中选出j个号码,然后从1到k中选出l个号码。
LG想知道他到底可以有多少种选择号码的方法。
Input
一行四个正整数 i j k l
Output
一行 选择号码的方法数(应该不必涉及高精度)
Sample Input
5 2 7 5
Sample Output
210
BZ:RE了N次,WA了N次。。。。别问我为什么,问就是菜,程序的鲁棒性太~~~,不,它根本没有鲁棒性。
//#include<bits/stdc++.h>
#include <stdio.h>
#include <iostream>
#include<algorithm>
//#include <map>
//#include <set>
//#include <vector>
//#include <queue>
//#include <stack>
#include <stdlib.h>
#include <cstring>
#include <string.h>
#include <string>
#include <math.h>
using namespace std;
typedef long long ll;
#define MAXN 105
#define INF 0x3f3f3f3f//将近ll类型最大数的一半,而且乘2不会爆ll
ll CC(ll a, ll b)
{
ll ans = 1;
if(b > a/2+1)
b = a-b;
for(ll i=1; i<=b; ++i)
{
ans*=(a-i+1);
ans/=i;
}
return ans;
}
int main()
{
int i, j, k, l;
cin >> i >> j >> k >> l;
cout << CC(i, j)*CC(k, l) << '\n';
return 0;
}