中国建设网官方网站硅灰,ui设计风格,服务公司标语,seo 最新原理
众所周知#xff0c;在c中#xff0c;用putchar和getchar输入输出字符的速度是很快的#xff0c;因此#xff0c;我们可以考虑把数字转化为字符#xff0c;按位输出#xff1b;把字符读入后转化为数字的每一位。
该快读快写可以实现对所有整数类型的输入。
templ…原理
众所周知在c中用putchar和getchar输入输出字符的速度是很快的因此我们可以考虑把数字转化为字符按位输出把字符读入后转化为数字的每一位。
该快读快写可以实现对所有整数类型的输入。
templatetypename Tinline void read(T x){bool f1;x0;char chgetchar();while(ch0||ch9){if(ch-)f!f;chgetchar();}while(ch0ch9){x(x1)(x3)(ch^48);chgetchar();}x(f?x:-x);return ;
}
templatetypename Tinline void write(T x){if(x0)putchar(-),x-x;if(x9)write(x/10);putchar(x%100);return ;
}