let totalMantou = 100; let totalPeople = 100; let adultMantou = 4; let childMantou = 1/4; for (let adults = 0; adults <= totalPeople; adults++) { for (let children = 0; children <= totalPeople; children++) { if (adults + children === totalPeople && adults * adultMantou + children * childMantou === totalMantou) { console.log(`大人数量: ${adults}, 孩子数量: ${children}`); } } }