模板---读入挂

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq1965610770/article/details/81388188
namespace IO { 
    const static int maxn = 200 << 20;
    static char buf[maxn], *pbuf = buf, *End;	//静态局部变量 
    //初始读入 
    void init() {
        int c = fread(buf, 1, maxn, stdin);
        End = buf + c;
    }
    //读数值 
    int readint() {
        static int ans;
        ans = 0;
        while (pbuf != End && (*pbuf<'0' || *pbuf>'9')) pbuf ++;
        while (pbuf != End && '0'<=*pbuf && *pbuf<='9') {
            ans = ans * 10 + *pbuf - '0';
            pbuf ++;
        }
        return ans;
    }
    //..... 
}
using namespace IO;

猜你喜欢

转载自blog.csdn.net/qq1965610770/article/details/81388188