2 Bucket Problem Solver Problem Statement : Suppose you have a "p" liter bucket and a "q" liter bucket. There is no other conatainer and neither do the buckets have measurement lines on them. How could you measure exactly "r" liters using only those buckets and you have as much extra water as you need ?
Rule 1 : p > q Rule 2 : p > r Rule 3 : r mod gcd(p, q) = 0
[NOTE : The rule enforcing is done by the program so you don't have to calculate it yourself :) ]