2
0
Fork 0
mirror of https://github.com/MartinThoma/LaTeX-examples.git synced 2025-04-26 06:48:04 +02:00

Remove trailing spaces

The commands

find . -type f -name '*.md' -exec sed --in-place 's/[[:space:]]\+$//' {} \+

and

find . -type f -name '*.tex' -exec sed --in-place 's/[[:space:]]\+$//' {} \+

were used to do so.
This commit is contained in:
Martin Thoma 2015-10-14 14:25:34 +02:00
parent c578b25d2f
commit 7740f0147f
538 changed files with 3496 additions and 3496 deletions

View file

@ -14,11 +14,11 @@
\clubpenalty = 10000 % Schusterjungen verhindern
\widowpenalty = 10000 % Hurenkinder verhindern
\hypersetup{
pdfauthor = {Martin Thoma},
pdfkeywords = {Google Code Jam, Round 1C 2013, Pogo},
pdftitle = {Proof of correctness for an algorithm for pogo}
}
\hypersetup{
pdfauthor = {Martin Thoma},
pdfkeywords = {Google Code Jam, Round 1C 2013, Pogo},
pdftitle = {Proof of correctness for an algorithm for pogo}
}
% From http://www.matthewflickinger.com/blog/archives/2005/02/20/latex_mod_spacing.asp
% Thanks!
@ -43,7 +43,7 @@ have to find a way to get to one coordinate $(x,y) \in \mathbb{Z} \times \mathbb
$(0, 0)$.
In your
$i$-th step you move either $\underbrace{(+i,0)}_{=: E}$,
$i$-th step you move either $\underbrace{(+i,0)}_{=: E}$,
$\underbrace{(-i,0)}_{=: W}$, $\underbrace{(0,+i)}_{=: N}$ or
$\underbrace{(0,-i)}_{=: S}$.
@ -114,7 +114,7 @@ It's enough to proof $s \geq s_{\min}$ and $s \leq s_{\min}$.
\begin{myindentpar}{1cm}
\textbf{Theorem: } $s \leq s_{\min}$ (we don't make too many steps)
\textbf{Proof: }
\textbf{Proof: }
\begin{myindentpar}{1cm}
We have to get from $(0,0)$ to $(x, y)$. As we may only move in
taxicab geometry we have to use the taxicab distance measure $d_1$:
@ -123,23 +123,23 @@ taxicab geometry we have to use the taxicab distance measure $d_1$:
So in our scenario:
\[d_1 \left ((0,0), (x,y) \right ) = |x| + |y|\]
This means we have to move at least $|x| + |y|$ units to get
This means we have to move at least $|x| + |y|$ units to get
from $(0,0)$ to $(x, y)$. As we move $i$ units in the $i$'th step,
we have to solve the following equations for $s_{\min1}$:
\begin{align}
\sum_{i=1}^{s_{\min1}} i &\geq |x| + |y| &&\text{ and } &|x| + |y| &> \sum_{i=1}^{s_{\min1} - 1} i\\
\frac{s_{\min1}^2 + s_{\min1}}{2} &\geq |x| + |y| && & &> \sum_{i=1}^{s_{\min1} - 1} i &
\frac{s_{\min1}^2 + s_{\min1}}{2} &\geq |x| + |y| && & &> \sum_{i=1}^{s_{\min1} - 1} i &
\end{align}
This is what algorithm \ref{alg:calculateSteps} check with \texttt{condition 1}.
As the algorithm increases $s$ only by one in each loop, it makes
This is what algorithm \ref{alg:calculateSteps} check with \texttt{condition 1}.
As the algorithm increases $s$ only by one in each loop, it makes
sure that $\sum_{i=1}^{s_{\min1} - 1} i$ is bigger than $|x| + |y|$.
You can undo moves by going back. But this will always make an even
number undone. When you go $(+i, 0)$ and later $(-j, 0)$ it is the
number undone. When you go $(+i, 0)$ and later $(-j, 0)$ it is the
same as if you've been going $(i-j, 0)$. So $2\cdot i$ steps got undone.
But $2\cdot i$ is an even number. You will never be able to undo
an odd number of moved units. This means, the parity of the minimum
an odd number of moved units. This means, the parity of the minimum
number of units you would have to move if you would move one unit per
step has to be the same as the parity of the moves you actually do.
This is exactly what \texttt{condition 2} makes sure.
@ -149,13 +149,13 @@ So we need at least $s$ steps $\Rightarrow s \leq s_{\min} \square$
\textbf{Theorem: } $s \geq s_{\min}$ (we make enough steps)
\textbf{Proof: }
\textbf{Proof: }
\begin{myindentpar}{1cm}
We chose $s$ in a way that \texttt{condition 1} is true.
As we have to go $i \in 1,\dots,s$, we can get every possible sum $\Sigma \in \Set{-\frac{s^2+s}{2}, \dots +\frac{s^2+s}{2}}$
with a subset of $\Set{1, \dots, s}$\footnote{This can easily be proved by induction over $\Sigma$.}.
This means we can make a partition $(A, \underbrace{\Set{1, \dots, s} \setminus A}_{=: B})$
such that $|\sum_{i \in A} i| = |x|$ and $|\sum_{i \in B} i|-2\cdot j = |y|$.
such that $|\sum_{i \in A} i| = |x|$ and $|\sum_{i \in B} i|-2\cdot j = |y|$.
This means, we can reach $(x,y)$ from $(0,0)$.
\end{myindentpar}
\end{myindentpar}
@ -163,10 +163,10 @@ This means, we can reach $(x,y)$ from $(0,0)$.
\subsection{solvePogo}
\textbf{Theorem: } \Call{solvePogo}{$x,y$} returns a valid, minimal sequence of steps to get from $(0, 0)$ to $(x,y)$
\textbf{Proof: }
\textbf{Proof: }
\begin{myindentpar}{1cm}
As $s_{\min}$ is the minimum amount of steps you need to get from
$(0,0)$ to $(x,y)$, \Call{solvePogo}{$x,y$} will return a minimal
As $s_{\min}$ is the minimum amount of steps you need to get from
$(0,0)$ to $(x,y)$, \Call{solvePogo}{$x,y$} will return a minimal
sequence of steps to get from $(0, 0)$ to $(x,y)$ (see proof above).
We only have to prove that the sequence of steps that \Call{solvePogo}{$x,y$}