公式集
什么神经题目
zsyun_Cg的公式集
来看看有没有能用上的奇妙小公式
禁搬
公式集
::::success[等差数列求和公式]
| 你想求什么 | 用什么公式 | 需要知道什么 |
|---|---|---|
| 第 n 项 |
||
| 前 n 项和 |
||
| 前 n 项和 |
||
| 项数 |
||
| 公差 |
||
| 首项 |
||
| 末项 |
::::
::::success[海伦公式]
已知三角形的三条边长分别为
令半周长为:
则三角形面积
::::
::::success[两点间距离公式]
已知平面上两点
或者等价地:
其中:
::::
::::success[排列与组合] 排列公式
排列数公式
循环排列(圆排列)
组合数公式
约分后(n...往下乘m个) / m!
表达式:
组合数的常用写法
组合数的性质
| 性质 | 公式 |
|---|---|
| 对称性 | |
| 递推公式 | |
| 边界条件 | |
| 二项式定理 |
排列与组合的关系
字母含义对照表
| 字母 | 含义 |
|---|---|
| 总元素个数 | |
| 取出的元素个数( |
|
| 从 |
|
| 从 |
|
| 组合数(同 |
|
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=1e5+10,M=1e3+10;
const int MOD_1=998244353,MOD_2=1e9+7,MOD_3=1e9+9;
const int INV2_1=499122177,INV2_2=500000004,INV2_3=500000005;
ll n,m;
ll qpow(ll a,ll b,ll mod){
ll res=1;
a%=mod;
while(b){
if(b&1) res=res*a%mod;
a=a*a%mod;
b>>=1;
}
return res;
}
ll inv(ll a,ll mod){//逆元
return qpow(a,mod-2,mod);
}
ll zuhe(ll n,ll m,ll mod){
if(m>n){
return 0;
}
ll num=1,den=1;
for(int i=0;i<m;i++){
num=num*(n-i)%mod;
den=den*(i+1)%mod;
}
return num*inv(den,mod)%mod;
}
int main(){
//freopen(".in","r",stdin);
//freopen(".out","w",stdout);
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin>>n>>m;
cout<<zuhe(n,m,MOD_2);//求组合数
return 0;
}
::::