怎么在讨论中放代码和公式

mulab 2019-07-16 10:05:04

讨论区是采用 Markdown 语法书写的。

代码块放在成对的三个反引号 ``` 之间,并可在第一组反引号前面标记语言,如 ```c++。例如:

#include <cstdio>

int main(){
    printf("Hello World\n");
    return 0;
}

段落内的引号用一对单个反引号括起来,例如 int main();

公式块放在成对的两个美元符号 $$ 之间,例如:

\frac{-b\pm \sqrt{b^2-4ac}}{2a}

段落内的公式用一对单个美元符号括起来,例如 x_1 + x_2 = -\frac{b}{a}

更多写法大家可以学习 Markdown 语法。

共 37 条回复

周宸YoungSean

\prod_{i=0}^{biggest}{jj}

周宸YoungSean

\sum_{i=0}^{n}{ij}

周宸YoungSean

\sum_{i=1}^{n}

周宸YoungSean

TeX parse error: Double exponent: use braces to clarify

周宸YoungSean
#include <cmath>
long long point[1010][2] = { 0 }, task1[1010][2] = { 0 }, task2[1010] = { 0 }, finishtime[1010] = { 0 },
          neartime[1010] = { 0 };
unsigned long long finish[1010] = { 0 };
int task3[1010][6] = { 0 };
bool sign[1010] = { 0 };
int main() {
    int x = 0, m, n;
    long long ys = 0, t = 0;
    unsigned long long money = 0;
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; i++) {
        int a;
        scanf("%lld%lld%lld%lld%lld%lld%d%llu", &point[i][0], &point[i][1], &task1[i][0], &task1[i][1],
              &task2[i], &neartime[i], &a, &finish[i]);
        task3[i][0] = a;
        for (int j = 1; j <= a; j++) scanf("%d", &task3[i][j]);
    }
    for (int i = 1; i <= m; i++) {
        int y, dlt;
        scanf("%d", &y);
        dlt = y - x;
        if(dlt < 0) dlt = -dlt; 
        t += dlt;
        x = y;
        ys += point[x][0];
        money += point[x][1];
        point[x][1] = 0;
        finishtime[x] = t;
        sign[x] = 1;
        if (finish[x] > 0 && task1[x][1] >= t && t >= task1[x][0]) {
            if (ys >= task2[x]) {
                bool flag = 1;
                for (int j = 1; j <= task3[x][0]; j++)
                    if (!sign[x] || finishtime[task3[x][j]] < t - neartime[x])
                        flag = 0;
                if (flag) {
                    money += finish[x];
                    finish[x] = 0;
                    printf("%d\n", x);
                }
            }
        }
    }
    printf("%llu", money + 1);
    return 0;
}```
周宸YoungSean

\sum

周宸YoungSean

sum

sum -b/b+a

周宸YoungSean

sum

周宸YoungSean

sum

周宸YoungSean

-b+-q/1