%{color:gold}Aux%
<tex>\[
\underbrace{ \overbrace{1, \hspace{0.2} 2}^{ \text{2}}, \overbrace{1}^{ \text{1}}}_{ \text{3 elemente}} \hspace{0.2cm}
\underbrace{ \overbrace{2, \hspace{0.2} 3}^{ \text{2}}, \overbrace{2}^{ \text{1}}}_{ \text{3 elemente}} \hspace{0.2cm}
\underbrace{ \overbrace{1, 2, 3, 4}^{ \text{4}}, \overbrace{3, 2, 1}^{ \text{3}}}_{ \text{7 elemente}} \hspace{0.2cm}
\underbrace{ \overbrace{2, 3, 4, 5}^{ \text{4}}, \overbrace{4, 3, 2, 1}^{ \text{3}}}_{ \text{7 elemente}} \hspace{0.2cm}
\underbrace{ \overbrace{1, 2, 3, 4, 5, 6}^{ \text{6}}, \overbrace{5, 4, 3, 2, 1}^{ \text{5}}}_{ \text{11 elemente}} \hspace{0.2cm}
\underbrace{ \overbrace{2, 3, 4, 5, 6, 7}^{ \text{6}}, \overbrace{6, 5, 4, 3, 2}^{ \text{5}}}_{ \text{11 elemente}}
\] &
</tex>
<tex>\[
\underbrace{\overbrace{1, 2, 3, \ldots ,n*2}^{ \text{n*2 elemente} }, \overbrace{(n*2)-1, (n*2)-2 \ldots, 1}^{ \text{n*2-1 elemente}} }_{ \text{n*4-1 elemente}} \hspace{0.2cm}
\underbrace{\overbrace{2, 3, 4, \ldots (n*2+1)+1}^{ \text{n*2 elemente}}, \overbrace{(n*2+1), (n*2+1)-1, \ldots, 1}^{ \text{n*2-1 elemente}} }_{ \text{n*4-1 elemente}}
\] &
</tex>
<tex>\[
f(n, in, i, p, u, x)=
\begin{cases}
-1, & \text{daca } x \geq n*2\\
x, & \text{daca } p \leq x \leq u, in - \text{par}\\
n-(x-p), & \text{daca } p \leq x \leq u, in - \text{impar}\\
(n-(u-p+1)+1)+(x-p), & \text{daca } x \leq n\\
f(n+1, in+1, i-1, u+1, u+2^{i-1}, x), & \text{altfel}
\end{cases}
\] &
</tex>
== code(cpp) |
#include <iostream>
using namespace std;