读入挂
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了读入挂相关的知识,希望对你有一定的参考价值。
可以加快一点读入速度,本地测试需要加读写文件
Code:
namespace fastIO
#define BUF_SIZE 100000
//fread -> read
bool IOerror = 0;
inline char nc()
static char buf[BUF_SIZE], *p1 = buf + BUF_SIZE, *pend = buf + BUF_SIZE;
if(p1 == pend)
p1 = buf;
pend = buf + fread(buf, 1, BUF_SIZE, stdin);
if(pend == p1)
IOerror = 1;
return -1;
return *p1++;
inline bool blank(char ch)
return ch == || ch == \\n || ch == \\r || ch == \\t;
inline void read(int &x)
char ch;
while(blank(ch = nc()));
if(IOerror)
return;
for(x = ch - 0; (ch = nc()) >= 0 && ch <= 9; x = x * 10 + ch - 0);
inline void readll(long long int &x)
char ch;
while(blank(ch = nc()));
if(IOerror)
return;
for(x = ch - 0; (ch = nc()) >= 0 && ch <= 9; x = x * 10 + ch - 0);
#undef BUF_SIZE
;
以上是关于读入挂的主要内容,如果未能解决你的问题,请参考以下文章