In this post I want to describe in short how to write a formulas on Codeforces. In fact it is short introduction to the markup language used on Codeforces.

## Three important rules.

Foremost rule: formula me place in dollars (`$`

), as well as in parentheses.

Another important rule: if you want to apply some operation to some group of symbols it is necessary to form the block using the curly braces. For instance, `2^x+y`

= 2^{ x} + *y*, but `2^{x+y}`

= 2^{ x + y}.

Third rule — for perfectionists. For traffic economy Codeforces print simple formulas by usually text. Sometimes it is not very pretty: `C_{x_i+y_i-2}^{x_i-1}`

= *C* _{ x i + y i - 2} ^{ x i - 1}. Is this case you can add command `\relax`

at the beginning of the formula. Then the formula is guaranteed to be beautiful: `\relax C_{x_i+y_i-2}^{x_i-1}`

= .

## Arithmetic operations.

Addition and subtraction can be written ordinary symbols + and -. Multiplication is usually indicated by a null character ( *xy* is the produst of numbers *x* and *y*) or by symbol (`\cdot`

). If it is necessary to multiply two complex expressions (), or are important both factors, not just the value of the product (in expressions of type *field *), use the symbol × , which may be obtained by the command `\times`

.

The division is somewhat more complicated. Usually in mathematics division is not written in one line, but the desire is not to write the fraction of the blue, too, is understandable. In this case, you can always write a `:`

or `/`

(`x:y`

, `x/y`

).

If you want to write all the same fraction, it has two similar commands: `\frac`

and`\dfrac`

. After any of these commands have to write a block of the numerator and block of the denominator, for example: (`\frac{1}{4}`

). Using `\frac`

small fractions are obtained, which is suitable mainly for the simple fractions. If you want to write a serious big fraction you'll need `\dfrac`

: (`\dfrac{x+y}{x^2+y^2}`

). If the numerator and denominator of a single-character, it can not be enclosed in brackets, for example: (`\frac14x`

), but only if the numerator is not a letter.

## The upper and lower indices.

If you want to write a lower index, you will help symbol `_`

and upper index (basically it is the exponent), the symbol`^`

: (*x* _{ i} + *y* _{ i})^{2} (`(x_i + y_i) ^ 2`

). Same manner as with the fractions in the lower or upper index block can be placed, but if a single-character index, it can not do so.

## Other useful tips and special characters

Text — text (`---`

) — not in the formulas, and in the text. This dash, not hyphen (it is not works without surrounding text)

(`\dots`

) — three dots symbol.

∞ (`\infty`

) — infinity symbol.

(`\in`

) and (`\ni`

) — element of the set.

→ (`\to`

) — arrow right, in expressions such as *x* _{ n} → 0.

Many well-known mathematical functions can be typed with the '\', then they will look like a formula, rather than simply as text ( = `\tg`

, = `\ln`

, = `\lim`

and so on)

If you want to index are top and bottom rather than the top-right and bottom-right, use the command `\limits`

:

= `\sum_{k = 0}^nx^k`

= `\sum\limits_{k = 0}^nx^k`

.

If the brackets around a large expression small, you can make them suitable size, written before the left bracket command `\left`

, and before right bracket command `\right`

. For instance: = `\left( \dfrac{x+y}{x^2+y^2} \right)`

.

Thank you for the attention!

X×Yx·yI find this very useful. Thank a lot, will start using it.

Thanks for your post! Here are a few more notes:

To get a binomial coefficient (the number of ways to choose

kobjects out ofntotal), you can write`\binom{numerator}{denominator}`

.You can put an equation on its own line by separating two dollar signs with line breaks:

which yields

Add

`\displaystyle`

at the beginning to make things look nicer.AoPS has a nice latex guide here (helpful sections are symbols and commands).

Thanks a lot, add another one "signed area of triangle"

Ais stand for the signed area of a triangle,(2A=

\begin{vmatrix}

x_0 & y_0 & 1 \

x_1 & y_1 & 1 \

x_2 & y_2 & 1 \

\end{vmatrix}

=x_0y_1+x_2y_0+x_1y_2-x_2y_1-x_0y_2-x_1y_0

) btw:two dollar signs are Omitted

for more useful tips of LaTeX, this website may help

http://meta.math.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference

× has a different purpose from scalar multiplication. For example, cross product, or Cartesian product

N×M. And, of course, * has a different purpose again; typically, it's a superscript or denotes convolution.You can always use parentheses and common · for scalar multiplication, regardless how complex the expressions are.

Just trying!$$$\displaystyle C_{x_i+y_i-2}^{x_i-1}$$$

$$$\displaystyle \binom{n}{k}$$$

$$$\displaystyle \sum\limits_{k = 0}^nx^k$$$

$$$\displaystyle \left(\dfrac{x+y}{x^2+y^2}\right)$$$

$$$\displaystyle (x_i + y_i) ^ 2$$$

$$$\displaystyle \frac abx$$$

$$$\displaystyle x_n\to\infty$$$

$$$\displaystyle (x+y)^n = \sum\limits_{k=0}^n \binom{n}{k} x^ky^{n-k}$$$

$$$(1+x+\cdot\cdot\cdot+x^{k})$$$ $$$ Let \ S=[S_1,S_2\cdot\cdot\cdot S_N] \,\,\,\,\,\,\,\, where\, S_i \,\,is\, \,\,a\,\, step\,\,\, you\,\, can\,\, take.$$$ $$$ So \,\,you \,\,have\,\, to\,\, find\,\, out\,\, solution\,\, of \,\,\,\,x_1S_1+x_2S_2+\cdot\cdot\cdot + x_nS_n=m. \,\,\,\,$$$ $$$which\,\, is\,\, same \,\,as \,\,finding \,\,coefficient \,\,of \,\,x^m \,\,in\,\, the\,\, polynomial \,\,\displaystyle \prod_{i=1}^{N}\displaystyle \left( \sum\limits_{k = 0}^{\infty}x^{kS_i}\right)$$$ **put dollar sign at the start and end of the line to get these **

\displaystyle C_{x_i+y_i-2}^{x_i-1} \displaystyle \binom{n}{k}

\displaystyle \sum\limits_{k = 0}^nx^k

\displaystyle \left(\dfrac{x+y}{x^2+y^2}\right)

\displaystyle (x_i + y_i) ^ 2

\displaystyle \frac abx

\displaystyle x_n\to\infty

\displaystyle (x+y)^n = \sum\limits_{k=0}^n \binom{n}{k} x^ky^{n-k} (1+x+\cdot\cdot\cdot+x^{k})

Nice blog, please add the symbol "$$$\in$$$" its

`\in`

.Also why this blog has too few comments?

Thank you, $$$\in$$$ and $$$\ni$$$ has been added.

$$$\int\limits_{t=0}^{t=\infty}\mathbb{E}[X_t] dt $$$

You can go here to get more information https://katex.org/docs/supported.html