跳到正文

剪贴板

剪贴板 v65wruyl

原文
剪贴板信息

剪贴板信息

收录
更新

返回上页\rule{120pt}{30pt}\kern{-85pt}\color{white}\raisebox{12pt}{\sf 返回上页}

快读快写 / fread & fwrite

C++
namespace FastIO {
	const int SZ = 1 << 18; char *p1, *p2, buf[SZ];
#define getchar() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, SZ, stdin), p1 == p2) ? EOF : *p1++)
	inline void skip() {for (char ch = getchar(); ch == ' ' || ch == '\n' || ch == '\t'; ch = getchar());}

	int t; char ch;
	template <class T> inline void read(T& x) {x = 0, t = 1, ch = getchar(); for (; ch < '0' || ch > '9'; ch = getchar()) if (ch == '-') t = -1; for (; '0' <= ch && ch <= '9'; ch = getchar()) x = (x << 1) + (x << 3) + (ch ^ 48); x *= t;}
	inline void read(char& x) {skip(), x = getchar();}
	template <class T, class... Args> inline void read(T& t, Args&... args) {read(t), read(args...);}
	template <class It> inline void read(const It& begin, const It& end) {for (It it = begin; it != end; it++) read(*it);}
	template <class T1, class T2> inline void read(pair<T1, T2>& p) {read(p.first), read(p.second);}

#ifndef DISABLE_FAST_WRITE
	char obuf[SZ], *p3 = obuf;
#define putchar(a) ((p3 - obuf < SZ) ? (*p3++ = a) : (fwrite(obuf, p3 - obuf, 1, stdout), p3 = obuf, *p3++ = a))
	inline void flush() {fwrite(obuf, p3 - obuf, 1, stdout);}
#endif //DISABLE_FAST_WRITE

	template <class T> inline void write(T x) {if (x < 0) putchar('-'), x = -x; static int st[40]; int top = 0; do {st[top++] = x % 10, x /= 10;} while (x); while (top) putchar(st[--top] ^ 48);}
	inline void write(const char c) {putchar(c);}
	inline void write(const std::string& s) {for (char c : s) putchar(c);}
	template <class T> inline void write(const char c, const T x) {write(x), putchar(c);}
	template <class T, class... Args> inline void write(T t, const char c, Args... args) {write(c, t), write(c, args...);}
	template <class T> inline void writeln(const T x) {write(x), putchar('\n');}
	template <class T> inline void writesp(const T x) {write(x), putchar(' ');}
	template <class It> inline void write(const char c, const It& begin, const It& end) {for (It it = begin; it != end; it++) write(*it), putchar(c);}
	template <class T1, class T2> inline void write(const char c, const pair<T1, T2>& p) {write(p.first), putchar(c), write(p.second);}
} using namespace FastIO;