1 bool Finish_read; 2 template<class T>inline void read(T &x) 3 { 4 Finish_read=0; 5 x=0; 6 int f=1; 7 char ch=getchar(); 8 while(!isdigit(ch)) 9 { 10 if(ch=='-')f=-1; 11 if(ch==EOF)return; 12 ch=getchar(); 13 } 14 while(isdigit(ch))x=x*10+ch-'0',ch=getchar(); 15 x*=f; 16 Finish_read=1; 17 } 18 template<class T>inline void print(T x) 19 { 20 if(x/10!=0)print(x/10); 21 putchar(x%10+'0'); 22 } 23 template<class T>inline void writeln(T x) 24 { 25 if(x<0)putchar('-'); 26 x=abs(x); 27 print(x); 28 putchar(' '); 29 } 30 template<class T>inline void write(T x) 31 { 32 if(x<0)putchar('-'); 33 x=abs(x); 34 print(x); 35 }
贴的某个大佬的板子,还没用过,不知道好不好用。