C ++ close synchronization stream ios :: sync_with_stdio (false)

Description: ios :: sync_with_stdio (false)

1. The phrase cin statement is used to cancel the sync, sync it what? Iostream is synchronized with stdio of the buffer. That's why cin and cout much slower than scanf and printf, because the first thing to be output into the buffer, and then output, resulting in reduced efficiency.

If you have been using using namespace std in header files; then you can remove the front std :: up.

 

2. can not be canceled after cin and scanf, sscanf, getchar, fgets like simultaneously with, otherwise it could lead to the expected output and not the same. (metaphysics)

 

3. endl replaced by "\ n", can also prevent timeout.

Guess you like

Origin www.cnblogs.com/icesunbo/p/11489212.html