跳到正文

剪贴板

剪贴板 46c7hk24

原文
剪贴板信息

剪贴板信息

收录
更新
C++
namespace FastIO {
	template <typename _Tp>
	inline void read(_Tp &x) {
		int neg = 1;
		char ch;
		while(ch = getchar(), !isdigit(ch)) if(ch == '-') neg = -1;
		x = ch - '0';
		while(ch = getchar(), isdigit(ch)) x = (x << 3) + (x << 1) + (ch ^ '0');
		x *= neg;
		return;
	}

	template <typename _Tp, typename... _Args>
	inline void read(_Tp &x, _Args &...args) {
		read(x);
		read(args...);
		return;
	}

	template <typename _Tp>
	inline void read(_Tp* begin, _Tp* end) {
		int len = end - begin;
		for(int i = 0; i < len; ++i) read(*(begin + i));
		return;
	}

	template <typename _Tp>
	inline void write(_Tp x) {
		if(x < 0) putchar('-'), x= -x;
		if(x > 9) write(x / 10);
		putchar(x % 10 + '0');
		return;
	}

	template <typename _Tp, typename... _Args>
	inline void write(_Tp x, _Args ...args) {
		write(x);
		write(args...);
		return;
	}

	template <typename _Tp>
	inline void write(_Tp* begin, _Tp* end) {
		int len = end - begin;
		for(int i = 0; i < len; ++i) write(*(begin + i)), putchar(' ');
		return;
	}
}