read 函数
1 inline int read() 2 { 3 int x=0; 4 bool f=1; 5 char c=getchar(); 6 for(; !isdigit(c); c=getchar()) if(c=='-') f=0; 7 for(; isdigit(c); c=getchar()) x=(x<<3)+(x<<1)+c-'0'; 8 if(f) return x; 9 return 0-x; 10 }
write 函数
1 inline void write(int x) 2 { 3 if(x<0){putchar('-');x=-x;} 4 if(x>9)write(x/10); 5 putchar(x%10+'0'); 6 }