# HDU 5698 瞬间移动 (2016"百度之星" - 初赛（Astar Round2B） 1003)

Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 140 Accepted Submission(s): 66

Problem Description

Input

Output

Sample Input
4 5

Sample Output
10

Source
2016”百度之星” - 初赛（Astar Round2B）

C(m+n4,n+2)=(n+m4)!(n2)!(m2)!

#include <iostream>
using namespace std;
typedef long long LL;
const LL MOD = 1000000007;
void exgcd(LL a, LL b, LL &x, LL &y)
{
if(b == 0)
{
x = 1;
y = 0;
return;
}
LL x1, y1;
exgcd(b, a%b, x1, y1);
x = y1;
y = x1-(a/b)*y1;
}
int main()
{
LL n, m;
while(cin>>n>>m)
{
LL ans = 1;
for(LL i=1; i<=n+m-4; i++)
ans = (ans*i)%MOD;
for(LL i=1; i<=n-2; i++)
{
LL x, y;
exgcd(i, MOD, x, y);
x = (x%MOD+MOD)%MOD;
ans = (ans*x)%MOD;
}
for(LL i=1; i<=m-2; i++)
{
LL x, y;
exgcd(i, MOD, x, y);
x = (x%MOD+MOD)%MOD;
ans = (ans*x)%MOD;
}
ans = (ans%MOD+MOD)%MOD;
cout<<ans<<endl;
}
return 0;
}

#### HDU－5698－瞬间移动

2016-06-01 18:15:17

#### 排列组合 hdu5698 瞬间移动

2016-05-23 01:17:33

#### hdu5698 瞬间移动（组合数取摸）(16百度之星round2B)

2016-05-22 23:00:27

#### HDU 5698 组合数学

2016-07-20 20:21:52

#### hdu5698 组合数学(求组合数)

2018-02-28 03:11:22

#### 【组合数学】HDU5698[瞬间移动]题解

2017-08-24 21:04:58

#### 变态跳台阶，最终导向HDU_5698_瞬间移动

2016-05-24 16:42:56

#### hdu 5698 组合数

2016-05-23 17:42:50

#### HDU 5698

2016-08-07 16:10:33

#### hdu5698 瞬间移动

2017-10-23 12:24:58