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

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

I see some very good coders such as snuke, Petr do this. struct Solver and writing their actual solution in the Solver's method void solve(). Is there any practical benefit of doing this?

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

»
2 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

They probably get used to code in Java, hence they use OOP/struct in C++.

»
2 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Don't know about them but i personally use this so that in multiple tc's questions i can write

This

Instead of

This
»
2 года назад, скрыть # |
 
Проголосовать: нравится +11 Проголосовать: не нравится

Ability to reset global variables at tasks with multitests

»
2 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

One advantage is that order of function defintions doesn't matter. You can use a function defined below your main function inside main function.

Code Example