教我卡常

感恩卡常模拟赛。

  1. 使用 \n 而不是 endl
  2. 使用常数而非变量
  3. 不要用那个破 cin 了,现在我们都喜欢快读!
namespace FastIO {
#define iL (1 << 20)
#define gc() ((iS == iT) ? (iT = (iS = ibuf) + fread(ibuf, 1, iL, stdin), (iS == iT) ? EOF : *iS++) : *iS++)
  char ibuf[iL], *iS = ibuf + iL, *iT = ibuf + iL;
  template<class T> inline void read(T &x) {
    char c = gc(); bool f = 0; x = 0;
    while(!isdigit(c)) f |= c == '-', c = gc();
    while(isdigit(c)) x = (x << 1) + (x << 3) + (c & 15), c = gc();
    if(f) x = -x;
  }
#undef iL
#undef gc
}

using namespace FastIO;
posted @ 2023-08-21 13:14  _maze  阅读(25)  评论(0编辑  收藏  举报