https://github.com/wwi2196/jug-problem
In this puzzle, you have two water jugs—one that can hold a liters of water and another that can hold b liters of water. The goal is to determine the minimum number of steps required to obtain exactly c liters of water in one of the vessels.
https://github.com/wwi2196/jug-problem
Last synced: 3 months ago
JSON representation
In this puzzle, you have two water jugs—one that can hold a liters of water and another that can hold b liters of water. The goal is to determine the minimum number of steps required to obtain exactly c liters of water in one of the vessels.
- Host: GitHub
- URL: https://github.com/wwi2196/jug-problem
- Owner: WWI2196
- License: apache-2.0
- Created: 2024-04-07T03:27:11.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-08-07T07:32:29.000Z (10 months ago)
- Last Synced: 2025-01-29T22:45:02.975Z (5 months ago)
- Language: C++
- Homepage:
- Size: 15.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
## The Two Water Jugs Puzzle
Given two jugs, one of which can accommodate #a liter of water and the other #b liters of
water, determine the number of steps required to obtain exactly c liters of water in one of
the vessels.
At the beginning, both vessels are empty. The following operations are counted as 'steps':
● emptying avessel
● filling a vessel
● pouring water from one jug to the other, without spilling, until one of the jugs is either full or empty.