Coding Games and Programming Challenges to Code Better
Send your feedback or ask for help here!
Created by @David_Augusto_Villa,validated by @DeanTheMachine,@TBali and @aflorido.
If you have any issues, feel free to ping them.
Coding Games and Programming Challenges to Code Better
Send your feedback or ask for help here!
Created by @David_Augusto_Villa,validated by @DeanTheMachine,@TBali and @aflorido.
If you have any issues, feel free to ping them.
Why is reading the prize values in the generated code done so strangely? First one value is read outside the loop, then all the others in the loop.
Maybe because we can’t add in a stub.
I’ve added a note to the default generated code saying as much. Unfortunately it’s not as flexible as you’d think, so this is the best current solution. It looks like the stub generator would be able to handle looping over (1 + height) items, but the webpage validator won’t let me test or submit it. If anyone knows of a way to work around the javascript, please let me know.
As far as I tested and know, the stub generator cannot do calculation. loop (h+1) does not work.
Programmers should always review and amend the generated template codes to fit their own needs.
The obvious, but not the most elegant solution is to simply add another variable for the number of prizes.
By the way, have you ever seen a cycle generated from “variable” + 1 in a puzzle?
Hi,
I think a test like this one would be really helpful among the first ones:
2
1
10
100
1
10000
answer : 10000
Sure, I see no harm in adding another simple test case, with a catcher of zero to make it interesting without breaking any code.
This is the first time I really truly struggled with an easy puzzle. I think I got so caught up by the dynamic programming tag that I was fully convinced the best way to solve this puzzle was bottom-up. O.o
Sorry about that, I wasn’t really sure which if any of the existing tags were appropriate. I assume you were able to complete it. How would you recommend tagging it?
I did the same lol… from bottom to up was a big mistake… I glad dynamic programming exist
Dynamic programming may be top-down or bottom-up.