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

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

Sometimes when I read "Tutorial" section for a problem, I get what it says but I can't code it. So I look at "Solution" section and try to understand. Then I realized that, it would be much better if there was some comment lines to explain how that code works.

Let me give an example:

Example

This is too easy and detailed. But you got what I want to say.

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

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

I'll just leave this link here: Best practices for writing code comments

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

I agree that comments may sometimes help you understand the code better. However, when I don't understand something in the editorial code it mostly comes from the difference in coding style, not the absence of comments. Understandably, this is to be expected, as the code in editorials is written by different problemsetters and testers.

To that matter, I would suggest reading not only the editorial code but also the submissions of other higher-rated people. Eventually, you are likely to find multiple smart people whose coding style is similar to yours and understand their code easier than the one in an editorial. Hope this helps :3

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

It will be helpful if each and every explanation of questions can be divide to two parts

Implemenation and Algorithms

Algorithms
Implementation
»
3 года назад, # |
  Проголосовать: нравится -8 Проголосовать: не нравится

maybe pseudocode would be nice, and comments will only be for shortcuts and tricks