做九度题的时候,由于数据量大,很多情况下得用scanf和printf代替cin和cout用于输入输出,不然会报错超时不能AC。
有三条建议用于提高C++的输入输出速度:
- At the first line in main function,add :std::ios_base::sync_with_stdio(false).which cancel theSynchronization between <iostream> and <cstdio>;
- At the second line in main function,add: std::cin.tie(0).which leads to that cin ties nothing.cin ties cout at first.