ACM-ICPC速度最快的读取方式,没有之一。
struct reader
{
const int MAXBUF = 1 << 20;
char buf[1<<20], *fh=NULL, *ft=NULL;
inline char gc()
{
if(fh == ft)
{
int l = fread(buf, 1, MAXBUF, stdin);
ft = (fh = buf) + l;
}
return *fh++;
}
inline int read()
{
int x = 0;
char c = gc();
for(; c < '0' || c > '9'; c = gc())
;
for(; c >= '0' && c <= '9'; c = gc())
x = (x << 3) + (x << 1) + c - '0';
return x ;
}
inline void _write(long long x)
{
if(x > 9)
_write(x / 10);
putchar(x % 10 + '0');
}
inline void write(long long x)
{
_write(x);
putchar('\n');
}
};
reader r;