summaryrefslogtreecommitdiff
path: root/other/fastIO.cpp
diff options
context:
space:
mode:
authorPaul Jungeblut <paul.jungeblut@gmail.com>2017-05-04 16:22:27 +0200
committerPaul Jungeblut <paul.jungeblut@gmail.com>2017-05-04 16:22:27 +0200
commit92f02961b71c82c91d2968c0b1f392c89d0dc57f (patch)
tree900b037ce90f2137bdef7e38b48c72b6860ce3ed /other/fastIO.cpp
parent8d5f3c5a9b10a5198fa2db0d298c843dd66c3719 (diff)
Adding fast Input/Output and Manacher's algorithm.
Diffstat (limited to 'other/fastIO.cpp')
-rw-r--r--other/fastIO.cpp24
1 files changed, 24 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);
+}