快读模板
getchar()
inline int read()
{
int s = 0, w = 1; // s数值 w符号
char ch = getchar();
while(ch < '0' || ch > '9')
{
if(ch == '-') w *= -1;
ch = getchar();
}
while('0' <= ch && ch <= '9')
{
// s = s * 10 + ch - '0';
s = (s << 1) + (s << 3) + (ch ^ 48);
ch = getchar();
}
return s * w;
}
ll read()
{
ll x=0,w=0;char ch=getchar();
while(!isdigit(ch))w|=ch=='-',ch=getchar();
while(isdigit(ch))x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
return w?-x:x;
}
fread()
char buf[1 << 21], *pi = buf, *p2 = buf;
// p1 means start-pointer, p2 means end-pointer
inline char gc()
{
if(pi = p2)
p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin);
return *(p1 ++);
}
inline int read()
{
int s = 0, w = 1; // s数值 w符号
char ch = gc();
while(ch < '0' || ch > '9')
{
if(ch == '-') w *= -1;
ch = gc();
}
while('0' <= ch && ch <= '9')
{
// s = s * 10 + ch - '0';
s = (s << 1) + (s << 3) + (ch ^ 48);
ch = gc();
}
return s * w;
}
标签:ch,char,while,快读,模板,getchar
From: https://www.cnblogs.com/hnu-hua/p/18179465