From 92f02961b71c82c91d2968c0b1f392c89d0dc57f Mon Sep 17 00:00:00 2001 From: Paul Jungeblut Date: Thu, 4 May 2017 16:22:27 +0200 Subject: Adding fast Input/Output and Manacher's algorithm. --- other/fastIO.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 other/fastIO.cpp (limited to 'other/fastIO.cpp') 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); +} -- cgit v1.2.3