Brijesh1in's blog

By Brijesh1in, history, 6 years ago, In English

I have seen that mostly great programmers use scanf in C++ while they can use cin with ios::sync_with_stdio(false); cin.tie(NULL); I want to know why??

Sorry because I don't know how to put things into a block .... Thanks in advance .....

  • Vote: I like it
  • +11
  • Vote: I do not like it

»
6 years ago, # |
  Vote: I like it -19 Vote: I do not like it

People use scanf because when the amount of test case are small the speed of scanf is still faster, but when the amount exceeds 1e7 cin overtakes scanf

  • »
    »
    6 years ago, # ^ |
      Vote: I like it +20 Vote: I do not like it

    cin is faster than scanf for large inputs? I did not know about that, can you provide some reference for that?

»
6 years ago, # |
Rev. 3   Vote: I like it +37 Vote: I do not like it

scanf / printf more powerful than cin / cout because it use regular expressions.

Examples

UPD: u can easy use scanf / printf in this problem, my solution with scanf, printf, sprintf

  • »
    »
    6 years ago, # ^ |
    Rev. 2   Vote: I like it +10 Vote: I do not like it

    A lot of what you mentioned can also be done with cin/cout, but sometimes it's a bit harder.

»
6 years ago, # |
  Vote: I like it 0 Vote: I do not like it

when you use sync_with_stdio you can no longer use some convenient and fast ways of input / output