比赛 |
2025暑期集训第6场 |
评测结果 |
AAAAAAAWWWWEEEEEEEEEE |
题目名称 |
Moo Route |
最终得分 |
33 |
用户昵称 |
李奇文 |
运行时间 |
4.546 s |
代码语言 |
C++ |
内存使用 |
18.83 MiB |
提交时间 |
2025-07-12 11:24:39 |
显示代码纯文本
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=3,M=1e6,mod=1000000007;
int n;
int a[N],inv[M],f[M];
int ksm(int a,int b){
int res=1;
for(;b;b>>=1,a=(1ll*a*a)%mod){
if(b&1) res=(res*a)%mod;
}
return res;
}
void init(){
inv[0]=inv[1]=1ll;
f[1]=1ll;
for(int i=2;i<M;++i){
f[i]=(f[i-1]*i)%mod;
inv[i]=ksm(f[i],mod-2);
}
}
int C(int y,int x){
return (f[x]*inv[y]%mod*inv[x-y])%mod;
}
signed main(){
freopen("moorouteg.in","r",stdin);
freopen("moorouteg.out","w",stdout);
init();
scanf("%lld",&n);
for(int i=1;i<=n;i++){
scanf("%lld",&a[i]);
a[i]/=2;
}
if(a[1]<=a[2]){
cout<<C(a[1]-1,a[2]-1)<<endl;
}else{
cout<<C(a[2],a[1])<<endl;
}
return 0;
}