当前位置:网站首页>Find the combinatorial number acwing 889. 01 sequence satisfying the condition
Find the combinatorial number acwing 889. 01 sequence satisfying the condition
2022-07-27 11:18:00 【T_ Y_ F666】
Find the combination number AcWing 889. Satisfied 01 Sequence
Original link
AcWing 889. Satisfied 01 Sequence
Algorithm tags
Combinatorial mathematics Combination count Carter LAN number Inverse element Fast power Fermat's small Theorem
Ideas

Code
#include<bits/stdc++.h>
#define int long long
#define abs fabs
#define rep(i, a, b) for(int i=a;i<b;++i)
#define Rep(i, a, b) for(int i=a;i>=b;--i)
using namespace std;
const int N = 100005, mod = 1e9+7;
int pr[N], st[N], s[N], cnt;
inline int read(){
int s=0,w=1;
char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
return s*w;
}
void put(int x) {
if(x<0) putchar('-'),x=-x;
if(x>=10) put(x/10);
putchar(x%10^48);
}
int qmi(int a, int b, int p){
int ans=1;
while(b){
if(b&1){
ans=ans*a%p;
}
a=a*a%p;
b>>=1;
}
return ans;
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n=read();
int res=1;
// Cn 2n
Rep(i, 2*n, n+1){
res=res*i%mod;
}
// / n + 1 % p Demand inverse element
rep(i, 1, n+2){
res=res*qmi(i, mod-2, mod)%mod;
}
printf("%lld\n", res);
}
Originality is not easy.
Reprint please indicate the source
If it helps you Don't forget to praise and support 
边栏推荐
- 9 UAV array
- 4 search insertion location
- Why is the data service API the standard configuration of the data midrange when we take the last mile of the data midrange?
- Miscellaneous records of Finance
- Solutions to errors in tensorflow operation
- 区间问题 AcWing 906. 区间分组
- SQL Server2000数据库错误
- 中国剩余定理 AcWing 204. 表达整数的奇怪方式
- 6 find the smallest letter larger than the target letter
- 背包问题 AcWing 9. 分组背包问题
猜你喜欢

tensorflow运行报错解决方法

博弈论 AcWing 891. Nim游戏

Use of parsel

A verification test of the relationship between iteration number and entropy

Analysis of C language pointer function and function pointer

博弈论 AcWing 894. 拆分-Nim游戏

博弈论 AcWing 892. 台阶-Nim游戏

Shock simulation of engine mounting system transient modal dynamic analysis and response spectrum analysis

Budweiser, a well-known beer, plans to launch NFT in an attempt to unveil the "long planned" uplink?

Influence of black and white pixel distribution on iteration times
随机推荐
数字三角形模型 AcWing 1018. 最低通行费
Tree DP acwing 285. dance without boss
解决 ImportError: cannot import name 'abs' 导入tensorflow报错
Memory search acwing 901. Skiing
Ansible
49字母异位分组和242有效的字母异位词
TensorFlow张量运算函数集
Redis+caffeine two-level cache enables smooth access speed
洛谷P1441 砝码称重
[FPGA tutorial case 40] communication case 10 -- Verilog implementation of a simple OFDM system based on FPGA
[shader realizes shake random shaking effect _shader effect Chapter 10]
Openatom openharmony sub forum, see you today at 14:00! Wonderful release of memorabilia attached
背包模型 AcWing 1024. 装箱问题
349两个数组的交集和01两数之和
Longest ascending subsequence model acwing 482. Chorus formation
最长上升子序列模型 AcWing 482. 合唱队形
parsel的使用
10 complete half of the questions
记忆化搜索 AcWing 901. 滑雪
最长上升子序列模型 AcWing 1010. 拦截导弹