管他会不会,知道结论就好了
紧急抢救知识
斯特林数
第一类斯特林数
递推公式
[S[n][k]=(n-1) imes S[n-1][k]+S[n-1][k-1]
]
处理的问题是将n个数划分为k个环
第二类斯特林数
递推公式
[S[n][k]=k imes S[n-1][k]+S[n-1][k-1]
]
purfer序列
purfer 序列是用来求n个点的树的形态个数的
无度数限制
有根树
[n^{n-1}
]
无根树
[n^{n-2}
]
有度数限制
有根树
[n*(n-2)!sum_{i=1}^{n}D_{i-1}
]
无根树
[(n-2)!sum_{i=1}^{n}D_{i-1}
]
在根号的时间内求解欧拉函数
LL euler(LL n)
{ //返回euler(n)
LL res=n,a=n;
for(LL i=2;i*i<=a;i++){
if(a%i==0){
res=res/i*(i-1);//先进行除法是为了防止中间数据的溢出
while(a%i==0) a/=i;
}
}
if(a>1) res=res/a*(a-1);
return res;
}