跳到正文

剪贴板

剪贴板 igcnjx62

原文
剪贴板信息

剪贴板信息

收录
更新
C++
namespace io
{
    char buf[1<<21],*p1=buf,*p2=buf;
    inline char getc()
    {
        return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;
    }
    template<typename T1>
    inline void read(T1& x)
    {
        x=0;int f=1;char ch=getc();
        while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getc();}
        while(ch>='0'&&ch<='9'){x=x*10+ch-48;ch=getc();}
        x*=f;
    }
    template<typename T1,typename ...Args>
    inline void read(T1& x,Args& ...args)
    {
        read(x);read(args...);
    }
    char buff[1<<21];
    int pa=-1;
    const int pb=(1<<21)-1;
    inline void fl()
    {
        fwrite(buff,1,pa+1,stdout);
        pa = -1;
    }//需要在main()函数结尾调用!!!
    inline void putc(const char &x)
    {
        if(pa == pb)fl();
        buff[++pa]=x;
    }
    template<typename T1>
    inline void print(T1 x)
    {
        static char st[35];
        int tp=0;
        if(x<0){putc('-'),x=-x;}
        if(x==0) putc('0');
        while(x)st[++tp]=(x%10)|48,x/=10;
        while(tp)putc(st[tp--]);
        putc('\n');
    }
    template<typename T1,typename ...Args>
    inline void print(T1 x,Args ...args)
    {
        write(x);write(args...);
    }
}
using namespace io;