版本比较
【模板】快速读入
正文
增加 11 行删除 11 行
2 行未改动34567789101112121314151616171819202121222324256 行未改动323334353636373839404 行未改动45464748494950515253545455565758585960616262636465666768686970717211 行未改动848586878888899091923 行未改动2 行未改动 private: static const int bufsize = 16384; std::streambuf *fb; char buf[bufsize], *s, *t;
public: fastinputstream() { fb = std::cin.rdbuf(); s = t = buf; }
public: char getc() { if (s == t) { s = buf; t = buf + fb->sgetn(buf, bufsize); t = buf + fb->sgetn(buf, bufsize); } char get = *s; return s++, get; }
public: template<class _int> void read(_int& x) { char ch = getc(); int sign = 1; x = 0;6 行未改动 ch = getc(); } x *= sign; }
public: template<class _int, class ..._args> void read(_int& a, _args& ... args) { read(a); read(args ... );4 行未改动 private: static const int bufsize = 16384; std::streambuf *fb; char buf[bufsize], *s, *t;
public: fastoutputstream() { fb = std::cout.rdbuf(); s = buf, t = buf + bufsize; }
public: void write(char ch) { fb->sputc(ch); }
public: void write(std::string s) { for (auto i : s) fb->sputc(i); }
public: void write(const char *ch) { int ln = strlen(ch); for (int i = 0; i < ln; i++) fb->sputc(ch[i]); }
public: template<class _int> void write(_int x) { int len = 0; static char stack[64];11 行未改动 } for (int i = len - 1; i >= 0; i--) fb->sputc(stack[i]); }
public: template<class _int, class ..._args> void write(_int a, _args ... args) { write(a); write(args ... );3 行未改动