读入优化

2018-07-15 15:55:40


template<class TT>
inline void read(TT &num) {
    TT x = 0, f = 1; char ch = getchar();
    while (ch<'0' || ch>'9') { if (ch == '-')f = -1; ch = getchar(); }
    while (ch >= '0'&&ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
    num = f * x;
}