跳到正文

个人记录

奇怪的快读快写

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

文章信息

发布
2026年8月15日
收录
2026年9月24日
更新
2026年10月28日
篇幅
约 1 分钟

版本

  1. v1当前

有时要把read、write改成rea、wri

C++
#include<bits/stdc++.h>
using namespace std;
struct rstream{
	rstream& operator>>(int &x){
		x=0;char c=getchar();
		while(!isdigit(c)) c=getchar();
		while(isdigit(c)) x=x*10+c-'0',c=getchar();
		return *this; 
	}
}read;
struct wstream {
	wstream& operator<<(int x){
		if(x<0) putchar('-'),x=-x;
		if(x<10){
			putchar(x+'0');
			return *this;
		}
		operator<<(x/10);
		putchar(x%10+'0');
		return *this;
	}
	wstream& operator<<(char c){
		putchar(c);
		return *this;
	} 
}write;
int main(){
	int x,y;
	read>>x>>y;
	write<<x+y<<' '<<x-y;
	return 0;
}
原文