1 条题解

  • 0
    @ 2025-10-17 7:40:00

    这是一篇教程,关于如何写出一篇漂亮的题解.

    此网站的编辑器支持 Markdown 语法HTML 语法,以及 Markdown 数学公式带来的 LaTeXLaTeX 语法.

    标题

    首先,题解需要根据思路分出不同的板块,而起到分割作用的,就是标题.

    要创建标题,请在单词或短语前面添加井号 (#) 。# 的数量代表了标题的级别. 例如,添加三个 # 表示创建一个三级标题,这也可以通过 HTML 中的 <h3></h3> 方法实现.

    以下为详细的示例:

    Markdown 语法 HTML 语法 预览效果
    # Heading level 1 <h1>Heading level 1</h1>

    Heading level 1

    # Heading level 2 <h2>Heading level 2</h2>

    Heading level 2

    # Heading level 3 <h3>Heading level 3</h3>

    Heading level 3

    # Heading level 4 <h4>Heading level 4</h4>

    Heading level 4

    # Heading level 5 <h5>Heading level 5</h5>
    Heading level 5
    # Heading level 6 <h6>Heading level 6</h6>
    Heading level 6

    当然,我们也可以使用另一种语法:在文本下方添加任意数量的 = 号来标识一级标题,或者 - 号来标识二级标题:

    Markdown 语法 HTML 语法 预览效果
    Heading level 1
    ===============
    <h1>Heading level 1</h1>

    Heading level 1

    Heading level 2
    ---------------
    <h2>Heading level 2</h2>

    Heading level 2

    请注意:为了保证在不同的 Markdown 编辑器中的兼容性,推荐在代表标题的 # 号与标题内容之间预留一个空格

    推荐做法 不推荐做法
    # Heading #Heading

    段落

    即使有了标题所分割出来的板块,段落仍然是一个很重要的概念,这能让你的题解看起来更加有序且舒适,而不是让所有的内容都挤在一起.

    创建段落很简单,只需要在不同的段落间预留一个空行(或者使用 HTML 语法中的 <p></p>):

    Markdown 语法 HTML 语法 预览效果
    Cervantes himself was a hero — spent most of his life tangled in the battles of knight-errantry, and died as a poor, struggling writer.

    Maybe he really did pour his spirit into Don Quixote.
    <p>Cervantes himself was a hero — spent most of his life tangled in the battles of knight-errantry, and died as a poor, struggling writer.</p><p>Maybe he really did pour his spirit into Don Quixote.</p>

    Cervantes himself was a hero — spent most of his life tangled in the battles of knight-errantry, and died as a poor, struggling writer.

    Maybe he really did pour his spirit into Don Quixote.

    可以发现,使用 HTML 语法时,虽然不需要在 <p> 间换行,但是这会使得源代码的可读性大大下降(在部分情况下,与 Markdown 不同,HTML 是一门“所见非所得”的编程语言),因此我们更推荐下面这种处理方式,尽管会使得 HTML 语法看起来多余无用:

    <p>Cervantes himself was a hero — spent most of his life tangled in the battles of knight-errantry, and died as a poor, struggling writer.</p>

    <p>Maybe he really did pour his spirit into Don Quixote.</p>

    注:不要使用制表符(Tab)或空格缩进段落,这对 Markdown 来说没有任何作用.

    推荐做法 不推荐做法
    Don Quixote is the epic of a world abandoned by God.

    Meaning may never fully permeate reality — but without it, reality dissolves into meaningless void.
        Don Quixote is the epic of a world abandoned by God.

      Meaning may never fully permeate reality — but without it, reality dissolves into meaningless void.

    换行

    换行更加容易,此处不再赘述.

    只需要在行末按下回车(Enter)即可,或者使用 HTML 语法中的 <br>.

    强调

    有时候我们希望突出强调某个词或某一部分,可以使用粗体斜体等方式.

    粗体(Bold)

    要加粗文本,请在单词或短语的前后各添加两个星号(*)或下划线(_). 如需加粗一个单词或短语的中间部分用以表示强调的话,请在要加粗部分的两侧各添加两个星号:

    Markdown 语法 HTML 语法 预览效果
    For starters, try making the **Black Lotus Blend**. For starters, try making the <strong>Black Lotus Blend</strong>. For starters, try making the Black Lotus Blend.
    For starters, try making the __Black Lotus Blend__. For starters, try making the Black Lotus Blend.
    The Latin word frāter is now used in the English word **frater**nal. The Latin word frāter is now used in the English word <strong>frater</strong>nal. The Latin word frāter is now used in the English word fraternal.

    你可能会注意到,在加粗一个单词或短语的中间部分时,我们并未使用下划线,这是因为不同的 Markdown 应用程序在如何处理单词或短语中间的下划线上并不一致. 为了保证最大兼容,不建议在此场景中使用下划线.

    斜体(Italic)

    要用斜体显示文本,请在单词或短语前后添加一个星号或下划线. 要斜体突出单词的中间部分,请在字母前后各添加一个星号:

    Markdown 语法 HTML 语法 预览效果
    I liked to look at the far-off buildings and *imagine*...what kind of lives that might be behind each of the windows. I liked to look at the far-off buildings and <em>imagine</em>...what kind of lives that might be behind each of the windows. I liked to look at the far-off buildings and imagine...what kind of lives that might be behind each of the windows.
    I liked to look at the far-off buildings and _imagine_...what kind of lives that might be behind each of the windows. I liked to look at the far-off buildings and imagine...what kind of lives that might be behind each of the windows.
    You've got only *One*Shot. You've got only _One_Shot. You've got only OneShot.

    以同样的理由,我们不推荐在斜体突出一个单词或短语的中间部分时使用下划线.

    粗体和斜体

    要同时用粗体和斜体突出显示文本,请在单词或短语的前后各添加三个星号或下划线. 要加粗并用斜体显示单词或短语的中间部分,请在要突出显示的部分前后各添加三个星号:

    Markdown 语法 HTML 语法 预览效果
    the realisation that each ***passerby*** has a life as vivid and complex as your own. the realisation that each <strong><em>passerby</em></strong> has a life as vivid and complex as your own. the realisation that each passerby has a life as vivid and complex as your own.
    the realisation that each ___passerby___ has a life as vivid and complex as your own. the realisation that each passerby has a life as vivid and complex as your own.
    the realisation that each __*passerby*__ has a life as vivid and complex as your own. the realisation that each passerby has a life as vivid and complex as your own.
    the realisation that each _**passerby**_ has a life as vivid and complex as your own. the realisation that each passerby has a life as vivid and complex as your own.
    \vdots

    最后,以同样的理由,我们不推荐……中间忘了……使用下划线(不推荐使用下划线!!!)(是的,刚刚这句加粗斜体使用了三个星号).

    引用

    有的时候,我们希望引用某句来自某部作品或任何其他地方的句子,可以通过在句子前使用一个 > 符号实现:

    > 理论都是灰色的,只有生命的金树长青。

    渲染效果如下:

    理论都是灰色的,只有生命的金树长青。

    块引用

    当然,我们也可以引用多个段落的句子

    块引用可以包含多个段落,只需要为段落间的空白行添加一个 > 符号:

    > 我只想给你原原本本地讲个故事,而不用前言和卷首惯有的许多十四行诗、讥讽诗和颂词来点缀。
    >
    > 我可以告诉你,虽然我编这个故事小费气力,却绝没有写这篇序言那么困难。

    渲染效果如下:

    我只想给你原原本本地讲个故事,而不用前言和卷首惯有的许多十四行诗、讥讽诗和颂词来点缀。

    我可以告诉你,虽然我编这个故事小费气力,却绝没有写这篇序言那么困难。

    嵌套块引用

    块引用可以嵌套,在要嵌套的段落前添加一个 >> 符号:

    > 例如,谈到自由和禁锢,你就写上:
    >
    >> 为黄金,失自由,并非幸福。

    渲染效果如下:

    例如,谈到自由和禁锢,你就写上:

    为黄金,失自由,并非幸福。

    带有其他元素的块引用

    块引用可以包含其他 Markdown 格式的元素,并非所有元素都可以使用,你需要进行实验以查看哪些元素有效:

    > 设函数 $f\left(x\right)$ 满足:
    > 1. 在 $\left[a, b\right]$ 上连续.
    > 2. 在 $\left(a, b\right)$ 内可导.
    > 3. $f\left(a\right)=f\left(b\right)$.
    >
    > 那么至少存在一点 $\xi\in\left(a, b\right)$ 使得 $f'\left(\xi\right)=0$.

    渲染效果如下:

    设函数 f(x)f\left(x\right) 满足:

    1. [a,b]\left[a, b\right] 上连续.
    2. (a,b)\left(a, b\right) 内可导.
    3. f(a)=f(b)f\left(a\right)=f\left(b\right).

    那么至少存在一点 ξ(a,b)\xi\in\left(a, b\right) 使得 f(ξ)=0f'\left(\xi\right)=0.

    列表

    有序列表

    要创建有序列表,请在每个列表项前添加数字并紧跟一个英文句点. 数字不必按数学顺序排列,但是列表应当以数字 11 起始:

    Markdown 语法 HTML 语法 预览效果
    1. First
    2. Second
    3. Third
    <ol>
    <li>First</li>
    <li>Second</li>
    <li>Third</li>
    </ol>
    1. First
    2. Second
    3. Third
    1. First
    1. Second
    1. Third
    1. First
    9. Second
    5. Third
    1. First
    2. Second
        1. Indented
        2. Indented
    3. Third
    <ol>
    <li>First</li>
    <li>Second</li>
    <ol>
    <li>Indented</li>
    <li>Indented</li>
    </ol>
    <li>Third</li>
    </ol>
    1. First
    2. Second
      1. Indented
      2. Indented
    3. Third

    无序列表

    无序列表与有序列表一样,只不过将元素前的数字换成了破折号 (-)、星号 (*) 或加号 (+),其效果看起来如下:

    • 1
    • 2
      • 1
      • 2
      • 3
    • 3
    • 4

    代码

    这是整个 Markdown 语法中最重要的一部分,我们毕竟在给需要写代码的题目撰写题解.

    要将单词或短语表示为代码,请将其包裹在反引号 (`) 中:

    Markdown 语法 HTML 语法 预览效果
    At the command prompt, type `nano`. At the command prompt, type <code>nano</code>. At the command prompt, type nano.

    转义反引号

    如果你要表示为代码的单词或短语中包含一个或多个反引号,则可以通过将单词或短语包裹在双反引号(``)中。

    Markdown 语法 HTML 语法 预览效果
    ``Plz use `code` in your passage.`` <code>Plz use `code` in your passage.</code> Plz use `code` in your passage.

    代码块

    要创建代码块,可以使用三个反双引号(```)将代码括住,并在首个三反双引号后写上对应语言的名称(如 CJava)等,代码将会自动按照对应语言的规则高亮显示.

    请将代码块的每一行缩进至少四个空格或一个制表符.

    例如,这是一个在 C++(也就是 cpp)中实现的 FFT 算法:

    ```cpp
    void FFT(Complex* a, int opt) {
        for (int i = 0; i < lim; i ++) {
            if (i < rev[i]) {
                swap(a[i], a[rev[i]]);
            }
        }
        for (int dep = 1; dep <= log2(lim); dep ++) {
            int m = 1 << dep;
            Complex w_n = Complex(cos(2.0 * PI / m), opt * sin(2.0 * PI / m));
            for (int k = 0; k < lim; k += m) {
                Complex w = Complex(1, 0);
                for (int j = 0; j > 1); j ++) {
                    Complex u = a[k + j];
                    Complex t = w * a[k + j + (m >> 1)];
                    a[k + j] = u + t;
                    a[k + j + (m >> 1)] = u - t;
                    w = w * w_n;
                }
            }
        }
        if (opt == -1) {
            for (int i = 0; i < lim; i ++) {
                a[i].Re /= lim;
            }
        }
    }
    ```

    在开头与末尾均要使用 ``` 将代码括住,并且第一行应该以 ```cpp 的方式表明,这是一段 C++ 语法下的代码.

    其渲染效果如下:

    void FFT(Complex* a, int opt) {
    	for (int i = 0; i < lim; i ++) {
    		if (i < rev[i]) {
    			swap(a[i], a[rev[i]]);
    		}
    	}
    	for (int dep = 1; dep <= log2(lim); dep ++) {
    		int m = 1 << dep;
    		Complex w_n = Complex(cos(2.0 * PI / m), opt * sin(2.0 * PI / m));
    		for (int k = 0; k < lim; k += m) {
    			Complex w = Complex(1, 0);
    			for (int j = 0; j < (m >> 1); j ++) {
    				Complex u = a[k + j];
    				Complex t = w * a[k + j + (m >> 1)];
    				a[k + j] = u + t;
    				a[k + j + (m >> 1)] = u - t;
    				w = w * w_n;
    			}
    		}
    	}
    	if (opt == -1) {
    		for (int i = 0; i < lim; i ++) {
    			a[i].Re /= lim;
    		}
    	}
    }
    

    数学公式

    此部分内容按理来说应该属于 LaTeXLaTeX 语法,但考虑到题解中可能不可避免地出现一些数学叙述,故在此对该部分内容简单阐述.

    在 Markdown 中,使用美元符号($)括住我们需要打出的 LaTeXLaTeX 数学公式代码. 当要使用代码来渲染某个数学组件时,应当以反斜杠(\)开头. 例如,要显示四分之三,我们可以在行内打出这样的代码:

    九又 $\frac{3}{4}$

    渲染效果如下:

    九又 34\frac{3}{4}.

    其中 \frac 代表的就是分式,

    也可以使用双美元符号($$)括住行间公式:

    设 $\left\{x_n\right\}_{n=0}^{N-1}$ 是某一满足有限性条件的序列,它的离散 Fourier 变换(DFT)为
    $$X\left(k\right)=\mathcal F\left\{x\left(n\right)\right\}=\sum_{n=0}^{N-1}x\left(n\right)\mathrm e^{-\mathrm i\frac{2\pi}Nkn}$$
    其逆变换是
    $$x\left(n\right)=\mathcal F^{-1}\left\{X\left(k\right)\right\}=\sum_{n=0}^{N-1}X\left(k\right)\mathrm e^{\mathrm i\frac{2\pi}Nkn}$$

    渲染效果如下:

    {xn}n=0N1\left\{x_n\right\}_{n=0}^{N-1} 是某一满足有限性条件的序列,它的离散 Fourier 变换(DFT)为

    $$X\left(k\right)=\mathcal F\left\{x\left(n\right)\right\}=\sum_{n=0}^{N-1}x\left(n\right)\mathrm e^{-\mathrm i\frac{2\pi}Nkn} $$

    其逆变换是

    $$x\left(n\right)=\mathcal F^{-1}\left\{X\left(k\right)\right\}=\sum_{n=0}^{N-1}X\left(k\right)\mathrm e^{\mathrm i\frac{2\pi}Nkn} $$

    当然,LaTeXLaTeX 的数学公式语法非常的复杂且精妙,篇幅所限无法尽数讲解,可以前往 LaTeX 公式编辑器 (直接点击该超链接即可跳转)来编辑并查看大部分语法.

    信息

    ID
    1
    时间
    1000ms
    内存
    64MiB
    难度
    6
    标签
    (无)
    递交数
    603
    已通过
    187
    上传者