【模板】快读、快写

用快读快写 不要开ios 不要开ios 不要开ios

这就和用scanf不能开ios是一样的

也可以用于__int128的写入与输出


快读

inline int read()
{
	int s=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){  
		if(ch=='-')  //处理负数
			f=-1;
		ch=getchar();  //处理其他字符
	}
	while(ch>='0'&&ch<='9'){
		s=s*10+ch-'0';
		ch=getchar();
	}
	return s*f;
}

快写

inline void write(int x)
{
    if(x<0){
    	putchar('-');
		x=-x;
	}
    if(x>9) 
		write(x/10);
    putchar(x%10+'0');
}

猜你喜欢

转载自blog.csdn.net/Whyckck/article/details/88659607