poj 1942 Paths on a Grid
2012-08-13 10:40
399 查看
简单的组合题:
View Code
View Code
#include<iostream> #include<cstdio> #include<cstdlib> #include<algorithm> #include<cmath> #include<queue> #include<set> #include<map> #include<cstring> #include<vector> #include<string> #define LL long long using namespace std; LL Gcd( LL a, LL b ) { return b ==0 ? a : Gcd( b , a % b ); } LL Get_C( LL n ,LL m ) { LL ans = 1,ans1 = 1; while( m ) { ans *= n; ans1 *=m; LL t = Gcd( ans , ans1 ); ans /= t; ans1 /= t; n --; m --; } return ans/ans1; } int main( ) { LL n,m; while( scanf( "%I64d %I64d",&n,&m ),n|m ) { printf( "%I64d\n",Get_C( n+m ,min( n , m ) ) ); } //system( "pause" ); return 0; }
相关文章推荐
- POJ-1942-Paths on a Grid
- POJ 1942 Paths on a Grid
- Paths on a Grid(POJ--1942
- poj 1942 Paths on a Grid 简单排列组合 + unsigned long long 使用方法
- D - Paths on a Grid POJ - 1942
- poj 1942 Paths on a Grid 求组合数mCn的方法
- Paths on a Grid(poj 1942)
- poj 1942 Paths on a Grid 【数学题】
- 文章标题 POJ 1942: Paths on a Grid(数学)
- POJ 1942 Paths on a Grid
- POJ 1942 Paths on a Grid
- poj1942 Paths on a Grid
- 组合数的递归调用:poj 1942 Paths on a Grid
- POJ 1942:Paths on a Grid
- POJ-1942 Paths on a Grid 组合数
- POJ 1942 Paths on a Grid(组合数公式)
- POJ 1942:Paths on a Grid
- 【POJ 1942】 Paths on a Grid
- poj 1942 Paths on a Grid
- POJ 1942 Paths on a Grid【组合数学】