# 4. Puzzle with animals

<figure><img src="/files/WSwESGwmelwgq69INRAM" alt=""><figcaption></figcaption></figure>

Có các loại động vật chó, mèo, thỏ. Và có các số cân nặng của chó và mèo, chó và thỏ, ...

Nhiệm vụ của ta là tìm cân nặng của mỗi con (nó khiến tôi liên tưởng đến bài số chân gà và chó 100 chân... bài toán tuổi thơ ở thời tiểu học)

Và lời giải z3py:

```python
>>> from z3 import *
>>> s = Solver()
>>> total = Int('total')
>>> dog, cat, rabbit = Ints('dog cat rabbit')

>>> s.add(10 == cat + rabbit, 20 == dog + rabbit, 24 == dog + cat)
>>> s.add(total == cat + dog + rabbit, cat >0, dog >0, rabbit >0)

>>> s.check()
sat

>>> s.model()
[dog = 17, total = 27, cat = 7, rabbit = 3]
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://viettaliii.gitbook.io/home/education/reverse-engineering/symbolic-analysis/sat-smt-by-example/equations/4.-puzzle-with-animals.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
