标签:etc code bool const for rom getc putc read
inline void read(int &x){
char ch;
bool flag=false;
for (ch=getchar();!isdigit(ch);ch=getchar())if (ch==‘-‘) flag=true;
for (x=0;isdigit(ch);x=x*10+ch-‘0‘,ch=getchar());
x=flag?-x:x;
}
inline void write(int x){
static const int maxlen=100;
static char s[maxlen];
if (x<0) { putchar(‘-‘); x=-x;}
if(!x){ putchar(‘0‘); return; }
int len=0; for(;x;x/=10) s[len++]=x % 10+‘0‘;
for(int i=len-1;i>=0;--i) putchar(s[i]);
}
标签:etc code bool const for rom getc putc read
原文地址:https://www.cnblogs.com/zhgyki/p/9551703.html