Skip to content

Commit

Permalink
Update example
Browse files Browse the repository at this point in the history
  • Loading branch information
llleixx committed Sep 26, 2024
1 parent 0cd5ac6 commit 69ffcb2
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 6 deletions.
4 changes: 3 additions & 1 deletion templates/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
contents:
contents:
- name: 图论
directory: 图论
- name: 数学
directory: 数学
- name: 数据结构
directory: 数据结构
6 changes: 3 additions & 3 deletions templates/图论/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
contents:
contents:
- name:
directory:
- name: lca
code: lca.cpp
code-pre: lca-pre.tex
code-post: lca-post.tex
- name:
directory:
2 changes: 1 addition & 1 deletion templates/图论/流/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
contents:
contents:
- name: maxFlow
code: maxFlow.cpp
5 changes: 5 additions & 0 deletions templates/数学/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
contents:
- name: 排列组合
code-pre: 排列组合-pre.tex
- name: 斐波那契数列
code-pre: 斐波那契数列-pre.tex
73 changes: 73 additions & 0 deletions templates/数学/排列组合-pre.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
组合数的性质:

\[
\binom{n}{m}=\binom{n}{n-m}\tag{1}
\]

相当于将选出的集合对全集取补集,故数值不变。(对称性)

\[
\binom{n}{k} = \frac{n}{k} \binom{n-1}{k-1}\tag{2}
\]

由定义导出的递推式。

\[
\binom{n}{m}=\binom{n-1}{m}+\binom{n-1}{m-1}\tag{3}
\]

组合数的递推式(杨辉三角的公式表达)。我们可以利用这个式子,在 $O(n^2)$ 的复杂度下推导组合数。

\[
\binom{n}{0}+\binom{n}{1}+\cdots+\binom{n}{n}=\sum_{i=0}^n\binom{n}{i}=2^n\tag{4}
\]

这是二项式定理的特殊情况。取 $a=b=1$ 就得到上式。

\[
\sum_{i=0}^n(-1)^i\binom{n}{i}=[n=0]\tag{5}
\]

二项式定理的另一种特殊情况,可取 $a=1, b=-1$。式子的特殊情况是取 $n=0$ 时答案为 $1$

\[
\sum_{i=0}^m \binom{n}{i}\binom{m}{m-i} = \binom{m+n}{m}\ \ \ (n \geq m)\tag{6}
\]

拆组合数的式子,在处理某些数据结构题时会用到。

\[
\sum_{i=0}^n\binom{n}{i}^2=\binom{2n}{n}\tag{7}
\]

这是 $(6)$ 的特殊情况,取 $n=m$ 即可。

\[
\sum_{i=0}^ni\binom{n}{i}=n2^{n-1}\tag{8}
\]

带权和的一个式子,通过对 $(3)$ 对应的多项式函数求导可以得证。

\[
\sum_{i=0}^ni^2\binom{n}{i}=n(n+1)2^{n-2}\tag{9}
\]

与上式类似,可以通过对多项式函数求导证明。

\[
\sum_{l=0}^n\binom{l}{k} = \binom{n+1}{k+1}\tag{10}
\]

通过组合分析一一考虑 $S=\{a_1, a_2, \cdots, a_{n+1}\}$$k+1$ 子集数可以得证,在恒等式证明中比较常用。

\[
\binom{n}{r}\binom{r}{k} = \binom{n}{k}\binom{n-k}{r-k}\tag{11}
\]

通过定义可以证明。

\[
\sum_{i=0}^n\binom{n-i}{i}=F_{n+1}\tag{12}
\]

其中 $F$ 是斐波那契数列。
8 changes: 8 additions & 0 deletions templates/数学/斐波那契数列-pre.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
\begin{enumerate}
\item 卡西尼性质(Cassini's identity):$F_{n-1} F_{n+1} - F_n^2 = (-1)^n$
\item 附加性质:$F_{n+k} = F_k F_{n+1} + F_{k-1} F_n$
\item 取上一条性质中 $k = n$,我们得到 $F_{2n} = F_n (F_{n+1} + F_{n-1})$
\item 由上一条性质可以归纳证明,$\forall k\in \mathbb{N},F_n|F_{nk}$
\item 上述性质可逆,即 $\forall F_a|F_b,a|b$
\item GCD 性质:$(F_m, F_n) = F_{(m, n)}$
\end{enumerate}
2 changes: 1 addition & 1 deletion templates/数据结构/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
contents:
contents:
- name: disjoint_set_union
code: disjoint_set_union.cpp
- name: fenwick-tree
Expand Down

0 comments on commit 69ffcb2

Please sign in to comment.