仅适用于整形的读入输出。
namespace FIO{
static char buf[1<<22],*s=buf;
inline char gc(){
static char buf[1<<22],*s=buf,*t=buf;
return s==t&&(t=(s=buf)+fread(buf,1,1<<22,stdin),s==t)?EOF:*s++;
}
inline void pc(char c){
if(s-buf==1<<22)fwrite(buf,1,1<<22,stdout),s=buf;*s++=c;
}
template<class T>inline T read(T&x){
char c=gc(),f=x=0;
while(c<'0'||c>'9')f|=c=='-',c=gc();
while(c>='0'&&c<='9')x=(x<<1)+(x<<3)+(c^48),c=gc();
return x=f?-x:x;
}
template<class T,class...Args>inline void read(T&x,Args&...args){
read(x),read(args...);
}
template<class T>inline void put(T x){
if(!x)return pc('0');
if(x<0)pc('-'),x=-x;
static int16_t s[44],p=0;
while(x)s[++p]=x%10,x/=10;
while(p)pc(s[p--]|48);
}
template<class T>inline void put(char c,T x){
put(x),pc(c);
}
template<class T,class...Args>inline void put(char c,T x,Args...args){
put(c,x),put(c,args...);
}
struct OUT{
inline ~OUT(){
fwrite(buf,1,s-buf,stdout);
}
}out;
}
using FIO::read;
using FIO::put;
标签:输出,read,void,args,char,put,读入,重载
From: https://www.cnblogs.com/safeng/p/16913996.html