快读+快写
不满足于代码速度的同学快来看了
快读
读入包含大量无用空格时,快读不太适用
1 inline int read() 2 { 3 register int sm=0,flag=1; 4 register char ch=getchar(); 5 while(ch<'0'||ch>'9'){if(ch=='-')flag=-1;ch=getchar();} 6 while(ch>='0'&&ch<='9'){sm=(sm<<1)+(sm<<3)+(ch^48);ch=getchar();} 7 return sm*flag; 8 }
快写
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 }