// n*m 的格子 从左下角走到右上角的种数
// 相当于从 n+m 的步数中选 m 步往上走
// C(n+m,m)
#include <iostream>
#include <string>
#include<sstream>
#include <cmath>
#include <map>
#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;
#define LL long long
LL C(LL n,LL k)
{
LL m=;
if(k>n/) k=n-k; // 不加这句会超时 比如C[10^9][10^9 - 1]
int i;
for(i=;i<=k;i++)
{
m*=(n-i+);
m/=i;
}
return m;
}
int main()
{
LL n,k;
while(scanf("%lld %lld",&n,&k),n|k)
{
printf("%lld\n",C(n+k,k));
}
return ;
}
相关文章
- [POJ3177]Redundant Paths(双连通图,割边,桥,重边)
- poj 3177 Redundant Paths
- tarjan算法求桥双连通分量 POJ 3177 Redundant Paths
- POJ--2158--------------Milking Grid(最小覆盖字符矩阵)---(开二维kmp)
- POJ 3177 Redundant Paths (桥,边双连通分量,有重边)
- POJ 3177 Redundant Paths / 边双连通分量
- POJ 2185 Milking Grid [二维KMP next数组]
- POJ 2185 Milking Grid(KMP)
- poj 3177 Redundant Paths 加入最少的边,使得无向图为一个双连通分支 有重边
- (poj 3177) Redundant Paths