Description
n只大象,每只大象高度为不超过m的自然数,且每只大象的身高都比它前面的大象高,问满足条件的大象序列有多少种
Input
两个整数n和m分别表示大象数量和大象身高上限(1<=n,m<=200)
Output
输出满足条件的方案数,结果模1e9+7
Sample Input
2 4
Sample Output
6
Solution
简单组合,答案显然为C(m,n)
Code
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<ctime>
using namespace std;
typedef long long ll;
#define INF 0x3f3f3f3f
#define maxn 222
#define mod 1000000007ll
ll C[maxn][maxn];
void init()
{
memset(C,0,sizeof(C));
for(int i=1;i<=200;i++)
{
C[i][0]=C[i][i]=1;
for(int j=1;j<i;j++)C[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;
}
}
int main()
{
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
int n,m;
init();
while(~scanf("%d%d",&n,&m))printf("%I64d\n",C[m][n]);
return 0;
}