Solve the problem c ++ cin, cout input and output efficiency due to the low operating results timeout

In doing pat when he met a timeout issue, first consider the algorithmic problems, when the algorithm no problem, we must consider the input and output problems, cin and cout efficiency is relatively low, there are two solutions.
1. cin and cout to scanf and the printf
2. cin and cout without change, added to the code snippet: ios :: sync_with_stdio (false);
This code segment can greatly improve the efficiency of the cin and cout.

Published 17 original articles · won praise 0 · Views 183

Guess you like

Origin blog.csdn.net/w17390956947/article/details/104965176