跳到正文

算法·理论

快读快写【模板】

hexuchen约 1 分钟
原文
文章信息与版本

文章信息

发布
2025年2月7日
收录
2025年12月12日
更新
2026年11月17日
篇幅
约 1 分钟

版本

  1. v1当前
C++
int read(){
	int sum=0,a=1;
	char c=getchar();
	while(c<'0' || c>'9'){
		if(c=='-'){
			a=-1;
		}
		c=getchar();
	}
	while(c>='0' && c<='9'){
		sum=sum*10+c-'0';
		c=getchar();
	}
	return sum*a;
}
void write(int a){
	if(a<0){
		a*=-1;
		putchar('-');
	}
	if(a>9)
		write(a/10);
	putchar(a%10+'0');
}
原文