输入输出挂

bool Finish_read;
template<class T> inline void read(T &x){  
	Finish_read = 0;
	x = 0;
	int f = 1;
	char ch = getchar();
	while(!isdigit(ch)){
		if(ch == '-'){
			f = -1;
		}
		if(ch == EOF){
			return ;
		}
		ch = getchar();
	}
	while(isdigit(ch)){
		x = x * 10 + ch - '0';
		ch = getchar();
		x *= f;
		Finish_read = 1; 
	}
}
template<class T>inline void print(T x){
	if(x / 10 != 0){
		print(x/10);
	}
	putchar(x % 10 + '0');
}
template<class T>inline void writeln(T x){
	if(x < 0){
		putchar('-');
	}
	x = abs(x);
	print(x);
	putchar('\n');
}
template<class T>inline void write(T x){
	if(x < 0){
		putchar('-');
	}
	x = abs(x);
	print(x);
	putchar(' ');
}

猜你喜欢

转载自blog.csdn.net/weixin_37686922/article/details/80781299