教我卡常

感恩卡常模拟赛。

  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 @   _maze  阅读(31)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· C#/.NET/.NET Core技术前沿周刊 | 第 29 期(2025年3.1-3.9)
· 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异
点击右上角即可分享
微信分享提示