diff options
Diffstat (limited to 'other')
| -rw-r--r-- | other/fastIO.cpp | 24 | ||||
| -rw-r--r-- | other/other.tex | 3 |
2 files changed, 27 insertions, 0 deletions
diff --git a/other/fastIO.cpp b/other/fastIO.cpp new file mode 100644 index 0000000..0077ce2 --- /dev/null +++ b/other/fastIO.cpp @@ -0,0 +1,24 @@ +void fastscan(int* number) { + bool negative = false; + register int c; + *number = 0; + c = getchar(); + while(c != '-' && (c < '0' || c > '9')) c = getchar(); + if (c == '-') negative = true, c = getchar(); + for (; c > 47 && c < 58; c = getchar()) *number = *number * 10 + c - 48; + if (negative) *number *= -1; +} + +void printPositive(int n) { + if (n == 0) return; + print(n / 10); + putchar(n % 10 + '0'); +} + +void fastprint(int n) { + if(n == 0) { putchar('0'); return; } + if (n < 0) { + putchar('-'); + print(-n); + } else print(n); +} diff --git a/other/other.tex b/other/other.tex index 7a941bf..b275c6e 100644 --- a/other/other.tex +++ b/other/other.tex @@ -6,6 +6,9 @@ \subsection{Bit Operations} \lstinputlisting{other/bitOps.cpp} +\subsection{Fast IO} +\lstinputlisting{other/fastIO.cpp} + \subsection{Sonstiges} \begin{lstlisting} // Alles-Header. |
