这是可以传入不定参数的快读
template<typename T>inline void read(T& x) {
x=0;int f=1;
char ch=getchar();
while(!isdigit(ch)){if(ch=='-')f=~f+1;ch=getchar();}
while (isdigit (ch)) {x=(x<<3)+(x<<1)+(ch^48);ch=getchar();}
x*=f;
}
template <typename T,typename... Args> inline void read(T& x, Args&... args) {
read(x);
read(args...);
}
如果我要这么写
inline void read(int& x) {
x=0;int f=1;
char ch=getchar();
while(!isdigit(ch)){if(ch=='-')f=~f+1;ch=getchar();}
while (isdigit (ch)) {x=(x<<3)+(x<<1)+(ch^48);ch=getchar();}
x*=f;
}
那我改怎么写?