CHICKEN & RABBIT

Chicken & rabbit, solve in seconds.

Enter total heads and legs to solve by the assumption method, with random practice — a classic primary-school olympiad problem.

假设全是鸡:脚 = 2 × 8 = 16 实际多出 6 只脚,每换 1 只兔多 2 脚 兔 = 6 ÷ 2 = 3 鸡 = 8 − 3 = 5

笼子里有 9 个头、24 只脚,鸡、兔各几只?

Most tools process data locally; see this page for details

Solution animation · assumption

Assume all in the cage are chickens: 8 heads

What is this?

Given the total heads and legs of chickens (2 legs) and rabbits (4 legs), solve by assuming all are chickens: rabbit = (legs − 2×heads) ÷ 2, chicken = heads − rabbit. Generate random quizzes below.

FAQ

How exactly does the assume-then-check method work?

The idea is to assume the cheapest option first. If all heads are chickens, total legs = heads × 2. Whatever the real total exceeds that by must come from rabbits, and each rabbit has 2 legs more than a chicken, so rabbits = (total legs − heads × 2) ÷ 2, and chickens = heads − rabbits. The whole problem is one division.

What happens if the numbers produce an impossible answer?

You get a nonsensical answer. A valid solution requires non-negative whole numbers for both chickens and rabbits. If your inputs lead to a fraction or a negative count, that dataset has no solution in this form (three heads with five legs, for instance) — just use another set of numbers.

Which other problems use the same method?

The same reasoning handles boats (assume all small boats), age problems with two rates, and profit/loss distribution problems: find the total difference, divide by the per-item difference. They all share the structure of one fixed difference per unit — compute the cheapest baseline, then divide the surplus by that difference.

示例与注意事项Example & notes

一个例子A worked example

头 35 只、脚 94 只:假设全是鸡只有 70 只脚,差 24 只,每换一只兔多 2 只脚,所以兔 12 只、鸡 23 只。35 heads, 94 legs: all chickens would give 70 legs, a shortfall of 24, and each rabbit adds 2 — so 12 rabbits and 23 chickens.

注意事项Things to watch

相关问答More Q&A

为什么可以先假设全是鸡?Why assume all chickens?

假设只是构造一个便于计算的起点,无论假设成什么,结论都一样。It is just a convenient starting point; the answer does not depend on which animal you assume.

能自己出题吗?Can I enter my own numbers?

可以,输入头数与脚数即可;无解时会明确提示。Yes — enter heads and legs; impossible combinations are flagged.

Further reading

觉得好用?Found it useful?