summaryrefslogtreecommitdiff
path: root/other/fastIO.cpp
diff options
context:
space:
mode:
authormzuenni <michi.zuendorf@gmail.com>2022-06-27 17:19:28 +0200
committermzuenni <michi.zuendorf@gmail.com>2022-06-27 17:19:28 +0200
commit5ab8a5088b729a9953b8dff1b2a985dc8fb2098b (patch)
treeed40d6936c0e9eee40ba62751cbf99ecddbaddc2 /other/fastIO.cpp
parentadabbad9c51cf7cd3874bfde8eac1fbcf84fec10 (diff)
updated tcr
Diffstat (limited to 'other/fastIO.cpp')
-rw-r--r--other/fastIO.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/other/fastIO.cpp b/other/fastIO.cpp
index 0077ce2..63f9ede 100644
--- a/other/fastIO.cpp
+++ b/other/fastIO.cpp
@@ -1,24 +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 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 >= '0' && c <= '9'; c = getchar()) number = number * 10 + c - '0';
+ if (negative) number *= -1;
}
void printPositive(int n) {
- if (n == 0) return;
- print(n / 10);
- putchar(n % 10 + '0');
+ if (n == 0) return;
+ printPositive(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);
+ if(n == 0) {putchar('0'); return;}
+ if (n < 0) {
+ putchar('-');
+ printPositive(-n);
+ } else printPositive(n);
}