Unverified Commit f1c2372b authored by 雷蒻's avatar 雷蒻 Committed by GitHub
Browse files

Update catalan.md

修复例题格式,代码格式,删除了重复的公式
parent 95493549
Loading
Loading
Loading
Loading
+19 −21
Original line number Diff line number Diff line
@@ -44,17 +44,14 @@ $$
H_n = \binom{2n}{n} - \binom{2n}{n-1}
$$

    f[n] = f[0] * f[n - 1] + f[1] * f[n - 2] + ... + f[n - 1] * f[0]

具体实例[https://www.luogu.org/problem/P1044](洛谷 P1044 栈)
??? note " 例题[洛谷 P1044 栈](https://www.luogu.org/problem/P1044)"
    题目大意:入栈顺序为 $1,2,\ldots ,n$ ,求所有可能的出栈顺序的总数。

```cpp
#include <iostream>

using namespace std;

int n;
long long f[25];

int main(){
    f[0] = 1;
    cin >> n;
@@ -64,12 +61,13 @@ $$
    cout << f[n] << endl;
    return 0;
}
```

## 路径计数问题

非降路径是指只能向上或向右走的路径。

1.  从 $(0,0)$ 到 $(m,n)$ 的非降路径数等于 m 个 x 和 n 个 y 的排列数,即 ${n + m \choose m}$ 。
1.  从 $(0,0)$ 到 $(m,n)$ 的非降路径数等于 $m$ 个 $x$ 和 $n$ 个 $y$ 的排列数,即 ${n + m \choose m}$ 。

2.  从 $(0,0)$ 到 $(n,n)$ 的除端点外不接触直线 $y=x$ 的非降路径数: