读入优化
int read() { char c;int ff=1; while((c=getchar())<'0'||c>'9') if(c=='-')ff=-1; int num=c-'0'; while((c=getchar())>='0'&&c<='9') num=num*10+c-'0'; return ff*num; }
输出优化
void write(int x) { if(x<0) { putchar('-'); x=-x; } if(x>9)write(x/10); putchar(x%10+'0'); }