Изменения рейтингов за последние раунды временно удалены. Скоро они будут возвращены. ×

Блог пользователя N8LnR2Nqf8Q4FN

Автор N8LnR2Nqf8Q4FN, история, 3 года назад, По-английски

There have been countless blogs about whether one should choose scanf/printf, or cin/cout as the main methods for getting inputs/outputs for C++. There are advantages and disadvantages of each kind, like the ability to easily format outputs, stream operator overloading, or not having to care about the decltype, etc.

But, from what I have seen, there are rarely any blogs that I can find myself, that mention the combination of cin/printf. This seems like a pretty good combination, and I have seen one or two people using it. One can get inputs without having to painfully type & every time, and nicely formatted outputs without a bunch of << operators.

Is there any disadvantage of this combination? Why do we hardly see anyone using those together?

  • Проголосовать: нравится
  • -8
  • Проголосовать: не нравится

»
3 года назад, # |
Rev. 2   Проголосовать: нравится +1 Проголосовать: не нравится

Because if you want to use cin/cout and scanf/printf together you cannot write in your code ios_base::sync_with_stdio(false);. This line speedups using cin/cout but you cannot then use scanf/printf, and using cin/cout without this line you can get TLE.