2 条题解
-
0
#include<bits/stdc++.h> using namespace std; typedef long long LL; LL qpow(LL a,LL b,LL p) { LL ans=1; for(;b;b>>=1) { if(b&1)ans=ans*a%p; a=a*a%p; } return ans; } LL C(LL n,LL m,LL p) { LL tn=1,tm=1; for(int i=1;i<=m;i++) { tn=tn*(n-i+1)%p; tm=tm*i%p; } return tn*qpow(tm,p-2,p)%p; } int main() { LL n,m;scanf("%lld%lld",&n,&m); LL p=20100403; LL ans=C(n+m,m,p)-C(n+m,m-1,p); ans=(ans+p)%p; printf("%lld\n",ans); return -
0
#include<bits/stdc++.h> using namespace std; typedef long long LL; LL qpow(LL a,LL b,LL p) { LL ans=1; for(;b;b>>=1) { if(b&1)ans=ans*a%p; a=a*a%p; } return ans; } LL C(LL n,LL m,LL p) { LL tn=1,tm=1; for(int i=1;i<=m;i++) { tn=tn*(n-i+1)%p; tm=tm*i%p; } return tn*qpow(tm,p-2,p)%p; } int main() { LL n,m;scanf("%lld%lld",&n,&m); LL p=20100403; LL ans=C(n+m,m,p)-C(n+m,m-1,p); ans=(ans+p)%p; printf("%lld\n",ans); return 0; }
- 1
信息
- ID
- 338
- 时间
- 2000ms
- 内存
- 128MiB
- 难度
- 9
- 标签
- 递交数
- 26
- 已通过
- 3
- 上传者