当前位置: 首页 > 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.zskr.cn/news/7221.html

相关文章:

  • kylin V11安装mysql8.4.5(glibc.2.28版本)
  • iOS 上架 App 流程全解析 苹果应用发布步骤、App Store 审核流程、ipa 文件上传与 uni-app 打包实战经验
  • P6801 花式围栏
  • ipadװwindowsϵͳshell
  • input 设置只输入数字或其他自定义字符 - 指南
  • 12-factors
  • huggingface 模型权重文件
  • P4147 玉蟾宫(悬线法)
  • 「Java EE开发指南」如何用MyEclipse开发Java EE企业应用程序?(二)
  • TENGJUN防水TYPE-C 16PIN连接器技术解析:从结构设计到认证标准的全面解读 - 实践
  • MMoE学习笔记:利用门控专家网络高效建模多任务关系
  • SpringMVC使用jasypt加密配置文件 - Commissar
  • 基于Python+Vue开发的口腔牙科预约管理系统源码+运行步骤
  • ECT-OS-JiuHuaShan 框架实现元推理,是人类文明的金种子
  • MATLAB实现连续投影算法
  • PS辉光眩光特效插件 BBTools Glow Glare 2 V2.4.3 For Photoshop
  • 深入解析:Model Context Protocol (MCP) 安全风险与攻击方式解析
  • 剑指offer-31、整数中1出现的次数
  • Centos7非LVM根分区容量不足后扩容,对调硬盘挂载/
  • 详细介绍:Vue3》》eslint Prettier husky
  • Java-Spring入门指南(十)纯Java类配备与@Configuration实战
  • TechInsights 拆解:蔚来“亚当(Adam)”超级计算机
  • 一根网线搞定远程运维,GL-RM1PE 深度体验:远程运维、装机、开机一体化的 KVM over IP - 详解
  • 在AI技术快速实现功能的时代,挖掘电子书阅读器新需求成为关键突破点
  • jtag协议处理流程 - 指南
  • 读人形机器人15未来城市
  • 解锁智能检索新境界:CriticGPT 赋能检索模型洞察人类偏好
  • US$39.99 3+1 Button Remote Key for Nissan 315Mhz FCC ID KBRASTU15 10pcs/lot
  • 编译Unity4.3.1f1
  • US$19 Smart Key Fob For Nissan Micra/Juke/Note Renault Alaska 433MHz