输入输出外挂
1 //适用于正整数 2 template <class T> 3 inline void scan_d(T &ret) { 4 char c; ret=0; 5 while((c=getchar())<'0'||c>'9'); 6 while(c>='0'&&c<='9') ret=ret*10+(c-'0'),c=getchar(); 7 }
1 //适用于正负整数 2 template <class T> 3 inline bool scan_d(T &ret) { 4 char c; int sgn; 5 if(c=getchar(),c==EOF) return 0; //EOF 6 while(c!='-'&&(c<'0'||c>'9')) c=getchar(); 7 sgn=(c=='-')?-1:1; 8 ret=(c=='-')?0:(c-'0'); 9 while(c=getchar(),c>='0'&&c<='9') ret=ret*10+(c-'0'); 10 ret*=sgn; 11 return 1; 12 }
1 inline void out(int x) { 2 if(x>9) out(x/10); 3 putchar(x%10+'0'); 4 }