跳到正文

个人记录

快读

MaHaoyi666约 2 分钟
原文
文章信息与版本

文章信息

发布
2026年7月25日
收录
2026年7月25日
更新
2026年11月17日
篇幅
约 2 分钟

版本

  1. v1当前

快读

C++
struct fr{
    char gc(){
        static const int IN_LEN=1<<18|1;
        static char buf[IN_LEN],*s,*t;
        return (s==t)&&(t=(s=buf)+fread(buf,1,IN_LEN,stdin)),s==t?-1:*s++;
    }
    template <typename _Tp> inline fr & operator >> (_Tp&x){
        static char ch,sgn; ch = gc(), sgn = 0;
        for(;!isdigit(ch);ch=gc()){if(ch==-1)return *this;sgn|=ch=='-';}
        for(x=0;isdigit(ch);ch=gc())x=x*10+(ch^'0');
        sgn&&(x=-x); return *this;
    }
}io;
#define cin io
struct fo{
    static const int OUT_LEN=1<<18;
    char obuf[OUT_LEN],*op;
    fo(){op=obuf;}
    ~fo(){fwrite(obuf,1,op-obuf,stdout);}
    inline void pc(char c){
        if(op==obuf+OUT_LEN)fwrite(obuf,1,OUT_LEN,stdout),op=obuf;
        *op++=c;
    }
    template <typename _Tp> inline fo&operator<<(_Tp x){
        static char stk[64],*top;top=stk;
        if(x<0)pc('-'),x=-x;
        do{*top++=x%10|'0';x/=10;}while(x);
        while(top!=stk)pc(*--top);return*this;
    }
    inline fo&operator<<(char c){pc(c);return*this;}
    inline fo&operator<<(const char*s){while(*s)pc(*s++);return*this;}
}out;
#define cout out
原文