模板 超级读优
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 namespace RD{ 2 const int sz=1<<15|1; 3 char ch,buf[sz],*l,*r; 4 void gechar(char &c) { 5 if(l==r) r=(l=buf)+fread(buf,1,sz,stdin); 6 c = l==r?EOF:*l++; 7 } 8 template<typename T> void read(T &x) { 9 gechar(ch); x=0; T f=1; 10 while(ch!='-'&&(ch<'0'||ch>'9')) gechar(ch); 11 if(ch=='-') f=-1,gechar(ch); 12 for(;ch>='0'&&ch<='9';gechar(ch)) x=x*10+ch-'0'; x*=f; 13 } 14 }