4 ms·
Whatever you do, you need to find some reasonable balance. You need to reason on what are the minimum possible values for the variables and what are the maximum
by Etherlord87 2y ago
Whatever you do, you need to find some reasonable balance. You need to reason on what are the minimum possible values for the variables and what are the maximums. In my example the reasoning effort was minimal, much less than figuring the `c` is even or the `w` is divisible by 5.
Otherwise OP made an error in using range(0, 100) instead of range(0, 101), but even here you could pedantically point out "how do you know the numbers can't be negative or over 100? You're not supposed to think too much when brute-forcing!" - well you have to do some minimal thinking always :P
Also notice my code is actually simpler.
- lupire 2y agoYour code also has a bug, which would affect the result in some variations of the problem with different parameters, but fortunately does not affect this specific version. You also used 100.
- Etherlord87 2y agoThe code wasn't written for other parameters, so it doesn't have a bug.