快速读入输出模板

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

inline void put(int x)
{
    if (x < 0)
        x = ~x + 1, putchar('-');
    if (x > 9)
        put(x / 10);
    putchar(x % 10 + '0');
}
原文地址:https://www.cnblogs.com/longl/p/9380756.html