今天我刷题了吗
搜索文档…
快速读写
1
template<typename T = int>
2
inline const T read()
3
{
4
T x = 0, f = 1;
5
char ch = getchar();
6
while (ch < '0' or ch > '9') {
7
if (ch == '-') f = -1;
8
ch = getchar();
9
}
10
while (ch >= '0' and ch <= '9') {
11
x = (x << 3) + (x << 1) + ch - '0';
12
ch = getchar();
13
}
14
return x * f;
15
}
16
17
template<typename T>
18
inline void write(T x, bool ln)
19
{
20
if (x < 0) {
21
putchar('-');
22
x = -x;
23
}
24
if (x > 9) write(x / 10, false);
25
putchar(x % 10 + '0');
26
if (ln) putchar(10);
27
}
Copied!
最近更新 1yr ago
复制链接