快速讀入模版 ...
快速讀入模版
template < class T > inline void read(T &x) {
x = 0;
char c = getchar();
bool f = 0;
while (!isdigit(c)) {
f ^= c == '-';
c = getchar();
}
while (isdigit(c)) {
x = (x << 3) + (x << 1) + (c ^ 48);
c = getchar();
}
if (f)
x = ~x + 1;
}
快速輸出模版
template < class T > inline void print(T x) {
if (x < 0) {
putchar('-');
x = ~x + 1;
}
if (x > 9)
print(x / 10);
putchar(48 + x % 10);
}