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

Автор codechefsucks, история, 10 лет назад, По-английски

Today i was coding a div2c problem

i got the idea and almost had good pseudo code in my mind

Then i started coding and took more than 2 hours to debug

What was the problem i cant implement because i dont have enough practise or is it because i didnt write down pseudo code ?

Thanks

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

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

I think you just have to practice more and write more codes

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

just write many mini-functions which helps you to find your mistakes quickly.after many practice it help's you and you will start coding without debuging,as red coders and many others.

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

I think it will help you if you practice at codechef problems

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

Code as much div2 C probelms you can until your coding time is around ~30 minutes for a good level C and about 15-20 for a easy C since level of C question varies a little from round to round.

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

i have been in this situation before .... two tips that works fine for me :

  • Think before coding .. don't rush ,after getting the idea know that you're not done yet and coding might be challenging .

  • write the full code on paper first .... computer bounds your mind , you shouldn't think about code while writing it .you may do that if the problem very easy to implement.

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

Before coding a solution it's a great idea to take some time and just think about it. Clear up the idea in your head and imagine the algorithm in action. It's often helpful to outline the steps your algorithm works in.

However I've personally never written down a detailed pseudo code or any code regarding implementation itself, just the idea and steps of the algorithm. If you have problems debugging that's most likely due to lack of experience. The more you code, the more common mistakes you fix and you learn to read your code and form a style. So in my opinion you should simply solve more and more problems.

And lame bugs that you debug for hours always happen from time to time, but your goal is to make it something rare :)

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

as said in this blog

all you need to do is practise,practise,practise

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

Rewriting the code after you get it accepted once helps! Also check others code (generally of those who are better than you)... It helps more more than it initially appears to.

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

i think you need to write more codes,i also have the same problem with E,D div2 where there is a big implementation,but after doing a huge number of problems i can write very fast code and most of the time i don't have problems with debugging D or C,but still have problem with E but i also remember the time when i had problems with C,so don't worry just practice,after some time you will be able to do problems with more difficulty quicker and quicker.

P.S. I also don't write the pseodocode.