Give a box of apples to several children. If each child is given 5 apples, there are 12 apples left. If each child is given 8 apples, the last child gets 8 apples, but there are less than 8 apples. Find the number of children and the number of apples in this box

Give a box of apples to several children. If each child is given 5 apples, there are 12 apples left. If each child is given 8 apples, the last child gets 8 apples, but there are less than 8 apples. Find the number of children and the number of apples in this box


If there are x children, then the number of apples is (5x + 12). According to the meaning of the question, we get: 0 < 8x - (5x + 12) < 8, which can be changed into: 3x − 12 > 03x − 12 < 8. The solution is: 4 < x < 203, ∵ x is a positive integer, ∵ x takes 5 or 6, when x = 5, 5x + 12 = 37; when x = 6, 5x + 12 = 42, ∵ there are two situations to meet the meaning of the question: ① there are 37 apples in this box, children have 5 digits; ② there are 42 apples in this box, children have 5 digits There are six friends