社区讨论
求快读模板
学术版参与者 6已保存回复 10
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 10 条
- 当前快照
- 1 份
- 快照标识符
- @mkjf593s
- 此快照首次捕获于
- 2026/01/18 15:32 上个月
- 此快照最后确认于
- 2026/01/21 21:35 4 周前
求一个简单高效的快读模板
CPP#include<bits/stdc++.h>
#define R io.read
#define W io.write
using namespace std;
typedef long long ll;
struct IO
{
char buf[1<<20],*p,*pp,obuf[1<<20],*q;
IO():p(buf),pp(buf),q(obuf){}
#define gc() (p==pp&&(pp=buf+fread(buf,1,1<<20,stdin),p=buf),p==pp?EOF:*p++)
#define pc(c) (q==obuf+(1<<20)&&fwrite(obuf,1,1<<20,stdout),*q++=(c))
~IO(){if(q!=obuf)fwrite(obuf,1,q-obuf,stdout);}
template<typename T>inline void read(T &x){x=0;char c=gc();bool f=0;while(c<'0'||c>'9')f|=(c=='-'),c=gc();while(c>='0'&&c<='9')x=x*10+(c^48),c=gc();if(f)x=-x;}
template<typename T,typename...Args>inline void read(T &x,Args&...args){read(x);read(args...);}
template<typename T>inline void write(T x){if(x<0)pc('-'),x=-x;if(x>9)write(x/10);pc(x%10+'0');}
inline void write(char c){pc(c);}inline void write(const char *s){while(*s)pc(*s++);}
template<typename T,typename...Args>inline void write(T x,Args...args){write(x);write(args...);}
}io;
这是之前使用的,但感觉还是不太便利,有没有大佬指点一下
回复
共 10 条回复,欢迎继续交流。
正在加载回复...