We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Thanks for that link. It made the problem easy. You need to satisfy two conditions: c<=a OR c<=b since the problem specified that ONE container held the desired quantity (if the quantity could be split across both containers then I guess this would be a much harder problem). The other condition is that c must be an integral multiple of gcd(a, b).
Die Hard 3
You are viewing a single comment's thread. Return to all comments →
Thanks for that link. It made the problem easy. You need to satisfy two conditions: c<=a OR c<=b since the problem specified that ONE container held the desired quantity (if the quantity could be split across both containers then I guess this would be a much harder problem). The other condition is that c must be an integral multiple of gcd(a, b).
My solution in lisp: