-
Notifications
You must be signed in to change notification settings - Fork 1
/
BIO1.cpp
52 lines (40 loc) · 1020 Bytes
/
BIO1.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// BIO1 - Rooks
// Author: Tarun Kumar
// E-mail: [email protected]
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define fab(i,a,b) for(i=a;i<=b;i++)
#define fabr(i,a,b) for(i=b;i>=a;i--)
using namespace std;
ll mod=1e9+7;
ll power(ll x,ll y)//0^0=1
{ll res=1;x=x%mod;if(x==0)return 0;while(y>0){if(y&1)res=(res*x)%mod;y=y>>1;x=(x*x)%mod;}return res;}
ll inverse(ll n)
{return power(n,mod-2);}
int main()
{
FAST;
ll t,n,i,j,k,l,p,q,r,ans,avg,sum,cnt,x,m;
t=1;
ll a[1000100];
a[0]=a[1]=1;
fab(i,2,1000100-1)
a[i]=(a[i-1]*i)%mod;
while(t--)
{
cin>>n>>m>>k;
if(k>n||k>m)
{
cout<<0;
continue;
}
ans=a[n];
ans=(ans*a[m])%mod;
ans=(ans*inverse(a[k]))%mod;
ans=(ans*inverse(a[n-k]))%mod;
ans=(ans*inverse(a[m-k]))%mod;
cout<<ans;
}
return 0;
}