C++ 加速cin和cout

在代码的第一行之前加上这样一句

#define IOS ios_base::sync_with_stdio(0); cin.tie(0);

然后在main()函数中使用 cin 和 cout 前先调用一次IOS即可实现加速效果

#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#include<iostream>
using namespace std;

int main() {
    IOS;
    int a, b;
    cin >> a >> b;
    ......
    return 0;
}
posted @ 2018-03-15 21:05  不想吃WA的咸鱼  阅读(151)  评论(0编辑  收藏  举报