List every way to spend a budget
Enumerate by apple count, including the allowed zero case.
The video could not load. Check your connection and try again, or download it directly.
Download video
Open Chinese transcript
- 在这家模拟小店,苹果每个三元,梨每个两元。正好花八元,只买完整水果,某种可以买零个。
- 先按苹果数量列。三个苹果就要九元,超过八元。所以苹果只能买零个、一个或两个,这三种都要检查。
- 零个苹果时,八元全买梨,可以买四个。这是第一种买法,不能因为没买苹果就漏掉。
- 一个苹果后剩五元,没法正好买整数个梨。两个苹果后剩两元,正好买一个梨。所以共有两种买法。
- 按零、一、二依次列,每种再检查剩下的钱,才知道有没有遗漏。找到一种,不代表已经找全。
- 现在加一条:苹果和梨都要买。刚才两种买法,哪种还能留下?请说说理由。小宝贝到你了
Sources for this explanation
Logical thinking
Bound the apple count, check each case, then filter again if a new condition is added.
Worked example
In a model shop apples cost 3 yuan and pears 2. Spend exactly 8 on whole fruit; buying zero of a kind is allowed. List all purchases.
The solutions are 0 apples and 4 pears, or 2 apples and 1 pear. One apple leaves 5 yuan, which cannot buy a whole number of pears.
Try one question
2×3+1×2=8 and includes both kinds. The first lacks apples; the third costs only 7.