看板娘加载较慢请耐心等待qwq~~~

快速输入输出模板

快速输入输出

indata() 输入函数
outdata()输出函数
在程序开头结尾调用。
ggt()返回0/1的opt
poread()整形读入
powrite()整形输出带换行

namespace nfdata
{
const int BS = 1 << 24;
const int SB = 1 << 22;
char buf[BS], *st, *ed;
char fub[SB], *bg = fub;
inline void indata()
{
    ed = buf + fread(st = buf, 1, BS, stdin);
}
inline void outdata()
{
    fwrite(fub, 1, bg - fub, stdout);
}
inline unsigned char ggt()
{
	register unsigned char x;
	while(!isdigit(x = (*st++)));
	return x == '1';
}
template <typename Y>
inline void poread(Y &res)
{
    register int ret = 0;
    char ch;
    while (!isdigit(ch = (*st++)))
        ;
    do
        ret = ret * 10 + ch - '0';
    while (isdigit(ch = (*st++)));
    res = ret;
}
template <typename T>
inline void powrite(T x)
{
	if(x < 10)
	{
		*bg++ = x + '0';
		*bg++ = '\n';
		return;
	}
	static char s[10];
	sprintf(s,"%d\n",x);
    memcpy(bg, s, sizeof(s));
	register int len = strlen(s);
	bg += len;
}
} // namespace nfdata
using nfdata::powrite;
using nfdata::poread;
using nfdata::ggt;
posted @ 2019-11-07 14:20  椎名·六花  阅读(239)  评论(0编辑  收藏  举报