我的FastIO有什么问题
  • 板块学术版
  • 楼主zbl2012
  • 当前回复3
  • 已保存回复3
  • 发布时间2025/8/2 12:49
  • 上次更新2025/8/2 19:38:33
查看原帖
我的FastIO有什么问题
1653348
zbl2012楼主2025/8/2 12:49

rt。总是会RE or WA 1~2个点,求解。

const int BUF_SIZE=1<<20;
struct FastIO{
	char ibuf[BUF_SIZE],obuf[BUF_SIZE];
	char *ip,*op;
	FastIO():ip(ibuf),op(obuf){
		fread(ibuf,1,BUF_SIZE,stdin);
	}
	~FastIO(){
		fwrite(obuf,1,op-obuf,stdout);
	}
	int read(){
		while(*ip<'0'&&*ip!='-')++ip;
		bool f=false;
		if(*ip=='-'){
			f=true;
			++ip;
		}
		int x=0;
		while(*ip>='0'&&*ip<='9'){
			x=x*10+(*ip++-'0');
		}
		return f?-x:x;
	}
	long long readll() {
		while(*ip<'0'&&*ip!='-')++ip;
		bool f=false;
		if(*ip=='-'){
			f=true;
			++ip;
		}
		long long x=0;
		while(*ip>='0'&&*ip<='9'){
			x=x*10+(*ip++-'0');
		}
		return f?-x:x;
	}
	void write(int x){
		if(x>9)write(x/10);
		*op++=x%10+'0';
	}
	void write(const char* s){
		while(*s)*op++=*s++;
	}
	void write(long long x){
		if(x>9)write(x/10);
		*op++=x%10+'0';
	}
}io;
2025/8/2 12:49
加载中...