博主头像
mxd's Blog

以技术为翼,以生活为魂

笔记:C++ IO 加速与 freopen 顺序无关

最近在备考 CSP-S2,做如下笔记:

ios::sync_with_stdio、cin.tie、cout.tie 和 freopen 顺序无关。
甚至可以交错书写(但不建议):

ios::sync_with_stdio(0);
freopen("1.in", "r", stdin);
cin.tie(0);
freopen("1.out", "w", stdout);
cout.tie(0);
笔记:C++ IO 加速与 freopen 顺序无关
https://blog.mxdyeah.com/post/cpp-io-sync-freopen-order-independent
本文作者 mxdyeah
发布时间 2026-10-28
许可协议 CC BY-NC-SA 4.0
发表新评论