I found a book with math quizzes. It was my father's when he was young. I encountered a problem with the following quiz. I solved it, but I wonder, is there a faster way to do it? If so, how can I compute the time (polynomial time) that is needed to solve it? Can we build an algorithm?

The problem is this one:

Two brothers have a cow that produces 10 kilos of milk per day. Because they are fair, they share the milk and each one gets 5 kilos.

They only have available three bottles.

$A$ that fits 10 kilos.

$B$ that fits 7 kilos.

$C$ that fits 3 kilos.

How do they share it?

What I did is these steps:

```
Bottle Sizes
A B C
10 7 3
Moves Bottles What we do:
1st 10 0 0 Fill the bottle A.
2nd 7 0 3 Fill the bottle C.
3rd 7 3 0 Empty the index of C in B.
4th 4 3 3 Refill C.
5th 4 6 0 Empty C in B.
6th 1 6 3 Refill C from A.
7th 1 7 2 Refill B from C.
8th 8 0 2 Empty the index of B in A.
9th 8 2 0 Empty the index of C in B.
10th 5 2 3 Refill C from A.
11th 5 5 0 Empty C in B.
```