fread和fwrite快读快写是需要文件输入输出还是标准输入输出也能用?我的代码无法在标准输入输出中使用,求调
namespace IO{
char buf[1<<20],pbuf[1<<20],*pp=pbuf,*p1,*p2;
#define gc() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<20,stdin),p1==p2)?EOF:*p1++)
template<typename T>
inline void read(T&x){
x=0;register char c=gc();register T f=1;
while(c<'0'||c>'9'){if(c=='-')f=-1;c=gc();}
while(c>='0'&&c<='9'){x=(x<<3)+(x<<1)+(c^48);c=gc();}x*=f;
}template<typename T,typename... Args>
inline void read(T &x, Args &... args){read(x);read(args...);}
inline void pc(const char&c) {
if(pp-pbuf==1<<20)fwrite(pbuf,1,1<<20,stdout),pp=pbuf;
*pp++=c;
}inline void write(int x){
static int sta[35];
register int top=0;
do{sta[top++]=x%10,x/=10;}while(x);
while(top)pc(sta[--top]+'0');
}using namespace std;
}using namespace IO;