两种,不知道两种谁快。。。
inline char nc() { static char buf[100000], *p1 = buf, *p2 = buf; return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2) ? EOF : *p1++; } inline int _read() { char ch = nc(); int sum = 0; while (!(ch >= '0'&&ch <= '9'))ch = nc(); while (ch >= '0'&&ch <= '9')sum = sum * 10 + ch - 48, ch = nc(); return sum; }
namespace fastIO { #define BUF_SIZE 100000 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 == ' ' || ch == ' ' || ch == ' '); } 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' ) ; } #undef BUF_SIZE }; using namespace fastIO;