当前位置: 首页 > news >正文

Fast IO 模板

放在 using namespace std; 后面即可。

namespace fast_IO {
#define FASTIO
#define IOSIZE 100000char ibuf[IOSIZE], obuf[IOSIZE];char *p1 = ibuf, *p2 = ibuf, *p3 = obuf;
#ifdef ONLINE_JUDGE
#define getchar() ((p1==p2)and(p2=(p1=ibuf)+fread(ibuf,1,IOSIZE,stdin),p1==p2)?(EOF):(*p1++))
#define putchar(x) ((p3==obuf+IOSIZE)&&(fwrite(obuf,p3-obuf,1,stdout),p3=obuf),*p3++=x)
#endif//fread in OJ, stdio in local#define isdigit(ch) (ch>47&&ch<58)
#define isspace(ch) (ch<33)template<typename T> inline T read() {T s = 0;int w = 1;char ch;while (ch = getchar(), !isdigit(ch) and (ch != EOF)) if (ch == '-') w = -1;if (ch == EOF) return false;while (isdigit(ch)) s = s * 10 + ch - 48, ch = getchar();return s * w;}template<typename T> inline bool read(T &s) {s = 0;int w = 1;char ch;while (ch = getchar(), !isdigit(ch) and (ch != EOF)) if (ch == '-') w = -1;if (ch == EOF) return false;while (isdigit(ch)) s = s * 10 + ch - 48, ch = getchar();return s *= w, true;}inline bool read(char &s) {while (s = getchar(), isspace(s));return true;}inline bool read(char *s) {char ch;while (ch = getchar(), isspace(ch));if (ch == EOF) return false;while (!isspace(ch)) *s++ = ch, ch = getchar();*s = '\000';return true;}template<typename T> inline void print(T x) {if (x < 0) putchar('-'), x = -x;if (x > 9) print(x / 10);putchar(x % 10 + 48);}inline void print(char x) {putchar(x);}inline void print(char *x) {while (*x) putchar(*x++);}inline void print(const char *x) {for (int i = 0; x[i]; ++i) putchar(x[i]);}inline bool read(std::string& s) {s = "";char ch;while (ch = getchar(), isspace(ch));if (ch == EOF) return false;while (!isspace(ch)) s += ch, ch = getchar();return true;}inline void print(std::string x) {for (int i = 0, n = x.size(); i < n; ++i)putchar(x[i]);}template<typename T, typename... T1> inline int read(T& a, T1&... other) {return read(a) + read(other...);}template<typename T, typename... T1> inline void print(T a, T1... other) {print(a);print(other...);}struct Fast_IO {~Fast_IO() {fwrite(obuf, p3 - obuf, 1, stdout);}} io;template<typename T> Fast_IO& operator >> (Fast_IO &io, T &b) {return read(b), io;}template<typename T> Fast_IO& operator << (Fast_IO &io, T b) {return print(b), io;}
#define cout io
#define cin io
#define endl '\n'
}
using namespace fast_IO;
http://www.wxhsa.cn/company.asp?id=7684

相关文章:

  • kylin V11安装mysql8.4.5(glibc.2.28版本)
  • iOS 上架 App 流程全解析 苹果应用发布步骤、App Store 审核流程、ipa 文件上传与 uni-app 打包实战经验
  • P6801 花式围栏
  • ms sql dml 操作
  • 黑白染色方法
  • Windows 数字签名获取与验证详解
  • 转化率提升300%,火山引擎Data Agent以“一客一策”突破企业营销增长瓶颈
  • 矩阵模板
  • 快读模板
  • ipadװwindowsϵͳshell
  • cpu的各种寄存器及其功能
  • 如何关闭电视的ACR功能及其对隐私保护的重大意义
  • huggingface 模型权重文件
  • vscode设置单击选中带连字符的单词
  • P4147 玉蟾宫(悬线法)
  • 全局平衡二叉树
  • Transactional注解的方法里 spring怎么知道我用的是哪个jdbctemplate实例
  • 根据参数查询
  • 关于非侵入式脑机接口面向C端一个应用想法
  • Blelloch并行扫描算法
  • 国产化DevOps生态崛起:Gitee如何赋能企业数字化转型
  • 【IEEE出版】2025年电气、控制与人工智能国际学术会议(ICOECAI 2025)
  • 采购计划 vs 物料需求计划(MRP),采购新手最容易搞混的两份“清单”!
  • P10299 [CCC 2024 S5] Chocolate Bar Partition
  • 实用指南:企业实施数字化转型时常见的挑战
  • 当ARMxy+AI边缘计算落地水泵行业就碰撞出怎样的火花?
  • QN8035 FM芯片驱动开发
  • 再见 Claude Code,我选择了 Codex!真香!!
  • 2025中国DevOps工具生态全景:本土化突围与智能化跃迁
  • 字符串转 python 对象 eval