快读

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^48);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');
}

但是由于递归的常数巨大

所以我们可以采用栈来输出

注:static 表示该全局变量在程序一开始运行便创立,不会每次输出重开浪费空间,但是其赋予初值也只在创建的时候赋一次,所以要另外赋予其初始值。

但是我们一般不用快写,用得不舒服。

如:

//wrong
void dfs(){
	static int a=0;
}
//right
void dfs(){
	static int a;
	a=0;
}

最终版本

#include<bits/stdc++.h>
#define ll long long
#define db double
#define filein(a) freopen(#a".in","r",stdin)
#define fileot(a) freopen(#a".out","w",stdout)
#define sky fflush(stdout)
template<class T>
inline void read(T &s){
	s=0;char ch=getchar();bool f=0;
	while(ch<'0'||'9'<ch) {if(ch=='-') f=1;ch=getchar();}
	while('0'<=ch&&ch<='9') {s=s*10+(ch^48);ch=getchar();}
	if(ch=='.'){
		int p=10;ch=getchar();
		while('0'<=ch&&ch<='9') {s=s+(db)(ch^48)/p;p*=10;;ch=getchar();};
	}
	s=f?-s:s;
}
int main(){
	filein(a);fileot(a);
	
	return 0;
}