只能用cin读string??
  • 板块灌水区
  • 楼主O2人
  • 当前回复4
  • 已保存回复4
  • 发布时间2021/9/25 20:01
  • 上次更新2023/11/4 05:39:25
查看原帖
只能用cin读string??
98390
O2人楼主2021/9/25 20:01
char Gt(){return (p1==p2&&(p2=(p1=buf)+fread(buf,1,buf_size,stdin),p1==p2))?EOF:*p1++;}
struct Fast_IO{
    Fast_IO&operator>>(std::string&S){
        S="";char ch=Gt();
        while (!isalpha(ch)) ch=Gt();
        while ( isalpha(ch)) S.push_back(ch),ch=Gt();
        return*this;
    }
    Te Fast_IO&operator>>(T&ret){
        ret=0;int f=1;char ch=Gt();
        while (!isdigit(ch)){if(ch=='-') f=-f;ch=Gt();}
        while ( isdigit(ch)) ret=(ret<<3)+(ret<<1)+(ch^48),ch=Gt();
        return ret*=f,*this;
    }
}fin;

如题,我这么读交洛谷上就挂了,但是改成cin直接A了。而且我本地Windows对拍也没有问题,求大佬解答。。。

2021/9/25 20:01
加载中...