个人模板

UPD on 2022.2.11: 大幅修改了模板,码风更清新。

#include <bits/stdc++.h>
// #include <bits/extc++.h>
using namespace std;
// using namespace __gnu_pbds;

namespace Pre {
	const int BufL = 1 << 16;
	char Buf[BufL], *BufS = Buf, *BufT = Buf;
	
	inline int gc() {
		if(BufS == BufT) {
			BufS = Buf;
			BufT = Buf + fread(Buf, 1, BufL, stdin);
			if(BufS == BufT)
				return EOF;
		}
		return *BufS++;
	}

	template<typename T>
	inline T read() {
		T f = 1, x = 0;
		char c = gc();
		while(!isdigit(c)) {
			if(c == '-')
				f = -1;
			c = gc();
		}
		while(isdigit(c)) {
			x = x * 10 + c - '0';
			c = gc();
		}
		return x * f;
	}

	template <typename T>
	inline void read(T& x) {
		x = read<T>();
	}

	template <typename T, typename... Args>
	inline void read(T& x, Args&... args) {
		read(x);
		read(args...);
	}

	template <typename T>
	inline void write(T x) {
		if(!x) {
			putchar('0');
			return;
		}
		if(x < 0) {
			putchar('-');
			x = -x;
		}
		vector<int> d;
		while(x) {
			d.emplace_back(x % 10);
			x /= 10;
		}
		reverse(d.begin(), d.end());
		for(int i : d) 
			putchar(i + '0');
	}
}
using namespace Pre;

namespace Solution {
	void Main() {
		
		return;
	}
}

int main() {
#ifdef LOCAL
	freopen("1.in", "r", stdin);
	freopen("1.out", "w", stdout);
#endif
	Solution :: Main();
	return 0;
}
/*

*/
posted @ 2021-09-16 14:33  Eason_AC  阅读(665)  评论(10编辑  收藏  举报