更快的输入挂

template <class T> void read(T& x)
{
    char ch = gc(); x = 0; bool f = 1;
    while (!('0' <= ch && ch <= '9') && ch != '-') ch = gc();
    if (ch == '-') f = 0, ch = gc();
    while ('0' <= ch && ch <= '9') x = (x << 1) + (x << 3) + ch - '0', ch = gc();
    if (!f) x = -x;
}

猜你喜欢

转载自www.cnblogs.com/mayouyou/p/9463970.html
今日推荐