快速读入输出模板

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');
}

 

posted @ 2018-07-28 09:42  BrysonChen  阅读(572)  评论(0编辑  收藏  举报