fread优化读入

inline char nc()
{
    static const int BS = 1 << 22;
    static unsigned char buf[BS],*st,*ed;
    if(st == ed) ed = buf + fread(st=buf,1,BS,stdin);
    return st == ed ? EOF : *st++;
}
//#define nc getchar
inline int read()
{
    char ch;
    int res = 0; bool flag = 0;
    while (!isdigit(ch = nc()));
    while (ch >= '0' and ch <= '9')
    {
        res = (res << 1) + (res << 3) + (ch - '0');
        ch = nc();
    }
    return res;
}

卡常

猜你喜欢

转载自www.cnblogs.com/zZh-Brim/p/9074423.html