跳到正文

剪贴板

剪贴板 edyk9873

原文
剪贴板信息

剪贴板信息

收录
更新
C++
namespace io
{
	const int size = (1 << 20) + 1;
	char buf[size], *p1 = buf, *p2 = buf;
	char buffer[size];
	int op1 = -1;
	const int op2 = size - 1;
	struct FastIO
	{
		inline char readchar()
		{
			return p1 != p2 ? *p1++ : p1 == (p2 = (p1 = buf) + fread(buf, 1, size - 1, stdin)) ? EOF
																							   : *p1++;
		}
// #ifndef ONLINE_JUDGE
// #define readchar getchar
// #endif
		inline char rc()
		{
			char c=readchar();
			while(c<32 || c==127) c=readchar();
			return c;
		}
		inline void flush()
		{
			fwrite(buffer, 1, op1 + 1, stdout), op1 = -1;
		}
		inline void writechar(const char &x)
		{
			if (op1 == op2)
				flush();
			buffer[++op1] = x;
		}
		inline int readint()
		{
			int s = 1, x = 0;
			char c = readchar();
			while (c <= 32)
			{
				c = readchar();
			}
			if (c == '-')
			{
				s = -1, c = readchar();
			}
			while ('0' <= c && c <= '9')
			{
				x = x * 10 + c - '0';
				c = readchar();
			}
			return x * s;
		}
		inline int readuint()
		{
			int x = 0;
			char c = readchar();
			while (c <= 32)
			{
				c = readchar();
			}
			while ('0' <= c && c <= '9')
			{
				x = x * 10 + c - '0';
				c = readchar();
			}
			return x;
		}
		inline void writeint(int x)
		{
			if (x < 0)
			{
				writechar('-'), x = -x;
			}
			char s[24];
			int n = 0;
			while (x || !n)
			{
				s[n++] = '0' + x % 10, x /= 10;
			}
			while (n--)
			{
				writechar(s[n]);
			}
		}
		inline void writeuint(unsigned x)
		{
			char s[24];
			int n = 0;
			while (x || !n)
			{
				s[n++] = '0' + x % 10, x /= 10;
			}
			while (n--)
			{
				writechar(s[n]);
			}
		}
		inline long long readlonglong()
		{
			long long x = 0, s = 1;
			char c = readchar();
			while (c <= 32)
			{
				c = readchar();
			}
			if (c == '-')
			{
				s = -1, c = readchar();
			}
			while ('0' <= c && c <= '9')
			{
				x = x * 10 + c - '0';
				c = readchar();
			}
			return x * s;
		}
		inline unsigned long long readulonglong()
		{
			unsigned long long x = 0;
			char c = readchar();
			while (c <= 32)
			{
				c = readchar();
			}
			while ('0' <= c && c <= '9')
			{
				x = x * 10 + c - '0';
				c = readchar();
			}
			return x;
		}
		inline void writelonglong(long long x)
		{
			if (x < 0)
			{
				writechar('-'), x = -x;
			}
			char s[25];
			int n = 0;
			while (x || !n)
			{
				s[n++] = '0' + x % 10, x /= 10;
			}
			while (n--)
			{
				writechar(s[n]);
			}
		}
		inline void writeulonglong(unsigned long long x)
		{
			char s[25];
			int n = 0;
			while (x || !n)
			{
				s[n++] = '0' + x % 10, x /= 10;
			}
			while (n--)
			{
				writechar(s[n]);
			}
		}
		inline int readstring(char *s)
		{
			int cnt = 0;
			char c = readchar();
			while (c <= 32)
			{
				c = readchar();
			}
			while (c > 32)
			{
				*s++ = c, ++cnt;
				c = readchar();
			}
			return *s = 0, cnt;
		}
		inline void writestring(const char *s)
		{
			while (*s)
			{
				writechar(*s++);
			}
		}
		inline double readdouble()
		{
			int zheng = 0, fuhao = 1;
			double xiao = 0, chushu = 10;
			char c;
			while ((c = readchar()) < '0' || c > '9')
			{
				if (c == '-')
				{
					fuhao = -1;
				}
			}
			while (c >= '0' && c <= '9')
			{
				zheng = zheng * 10 + c - '0';
				c = readchar();
			}
			if (c != '.')
			{
				return fuhao * zheng;
			}
			while ((c = readchar()) >= '0' && c <= '9')
			{
				xiao += (c - '0') / chushu;
				chushu *= 10;
			}
			return fuhao * (zheng + xiao);
		}
	} io;
#define readc io::io.rc
#define writec io::io.writechar
#define read io::io.readint
#define readu io::io.readuint
#define write io::io.writeint
#define writeu io::io.writeuint
#define readl io::io.readlonglong
#define readlu io::io.readulonglong
#define writel io::io.writelonglong
#define writelu io::io.writeulonglong
#define reads io::io.readstring
#define writes io::io.writestring
#define readd io::io.readdouble
#define flush io::io.flush
} using namespace io;