Measure Milk by Cans

Puzzle • Mathematics

Max Score: 40


Given two cans of milk with capacities of A and B liters, and a third can with a capacity of C liters, the task is to measure exactly D liters using these cans. You can perform the following operations: fill a can, empty a can, or pour milk from one can to the other, until either the first can is empty, or the second can is full.