Skip to content

Instantly share code, notes, and snippets.

@pranithan-kang
Last active April 9, 2026 04:58
Show Gist options
  • Select an option

  • Save pranithan-kang/db69495134ef90992abcee94f4dab19c to your computer and use it in GitHub Desktop.

Select an option

Save pranithan-kang/db69495134ef90992abcee94f4dab19c to your computer and use it in GitHub Desktop.
How to get 11kg problem

How to get 11kg problem

Problem

We have 2 bucket that can be filled with 13kg and 5kg respectively. Certainly, we have a lot of sand. We can use unlimited sand. How can we get 11kg of sand from a huge sand pile?

Solution Trial

first trial

Action b5 b13
start 0 0
fill b5 5 0
pour b5 => b13 0 5
fill b5 5 5
pour b5 => b13 0 10
fill b5 5 10
pour b5 => b13 2 13
pour b13 2 0
pour b5 => b13 0 2
fill b5 5 2
pour b5 => b13 0 7
fill b5 5 7
pour b5 => b13 0 12
fill b5 5 12
pour b5 => b13 4 13
pour b13 4 0
pour b5 => b13 0 4
fill b5 0 9

second trial

Action b5 b13
start 0 0
fill b13 0 13
pour b13 => b5 5 8
pour b5 0 8
pour b13 => b5 5 3
pour b5 0 3
pour b13 => b5 3 0
fill b13 3 13
pour b13 => b5 5 11 <-- solution found
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment