快速读入模版
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);
}
原文地址:https://www.cnblogs.com/heartlesser/p/10170688.html
时间: 2024-10-11 07:52:13