其实代码里也可以用这句:`std::ios::sync_with_stdio(false)`
据说`cin`和`cout`用了这句话,比`scanf`和`printf`快
@[青丘杨哲](/space/show?uid=54456)
by yjxyjx @ 2018-06-08 16:24:38
本人也曾经实测过ios::sync_with_stdio(false)
确实比scanf和printf快,只是提交的时候并没有想那么多
by 青丘杨哲 @ 2018-06-09 08:34:34
std::ios::sync_with_stdio(false)
这个东西最好别用,实测有Bug,有时候用这个和不用这个的cin的效果是不一样的,当然,不用的是正确的
by Huami360 @ 2018-07-20 21:11:46
@[Qihoo360](/space/show?uid=61834)
```ios::sync_with_stdio(false)```实测中只要不是读入为空,就不会出现运行错误。然后这东西会干扰scanf和printf,所以,开了之后就不能再用scanf和printf了。
by xyc1719 @ 2018-08-03 16:08:14
输出endl的时候cout会执行一次flush,然后爆炸
把endl改成'\n'并且在最后手动flush一下就好了
by _mxi @ 2018-09-22 11:00:33