Problem 281. Acid and water
⚖ ⚖ ⚖ ⚖ ⚖ ⚖ ⚖ ⚖
Assume that there is a 100 liter tank.
It is initially filled with just distilled water.
It is continuously drained at R liters per minute.
This tank is always maintained full and homogeneous by continuously adding and stirring R liters per minute of an unknown acid (or some fancy oil if it helps you solving this problem).
How many liters W of water will be in the tank after M minutes?
Neglect any expansion or contraction when the acid is mixed with water.
Solution Stats
Problem Comments

7 Comments
It makes no sense to speak of the mixture being part acid and part water. In fact the quantity of water is always 100, and the acid has a certain strength. It would have been better to get us to calculate the acid strength
Needs more test cases to disqualify the nonsolutions that simply exploit the testcase space.
More test cases in the Test Suite is generally welcome, and also the threat of potentially adding (even) more cases in the future can deter hardcoded "nonsolutions".
Most the leading solutions are just overfit the test cases, and meaningless.
This problem seems weird, I've solved the last test with hacking after using harmonic mean for the others, because I've imagined the speed was constant. However, people who solved without a hack acted as the speed was decreasing. And that doesn't make sense to me (it is not written at the problem description). The problem description IMHO needs to be changed if that's what the author was aiming. If you are reading this before trying to solve it, please, think about exponential decay. It is not linear despite the problem not saying so. Without this previous sentence, one may lose time trying several different solutions (like some people did in the solution set) or just hack it instead of learning something new (just point people at the right direction; they still can try some other technique if they want). Especially since the goal in Cody is to create a small solution.
And I agree that more test cases should be added, besides improving its description. In Cody, there are broken tests. So we can never be sure at times wether our code or the test set is bogus.
The total flow rate is constant, but because the tank is stirred to be homogeneous, the flow rate of water is proportional to the amount of water left.
Solution Comments
Show commentsProblem Recent Solvers252
Suggested Problems

Select every other element of a vector
31539 Solvers

302 Solvers

706 Solvers

Predicting life and death of a memoryless light bulb
322 Solvers

86 Solvers
More from this Author100
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!