114k views
2 votes
A group of 18 people ordered soup and sandwiches for lunch. Each person in the group either ordered one soup or one sandwich . The sandwiches cost $7.75 and the soup cost $4.50 if the total cost of all the food was $113.50 how many sandwiches where ordered?

User TPete
by
8.3k points

1 Answer

3 votes
Let's say a = number of ordered soups, b = number of ordered sandwiches.

Then 4.5a + 7.75b = 113.50, and a and b are integers between 0 and 18 inclusive.

How do we tackle this? If all ordered soup, the cost would be $81, so we'll have at least 4 sandwiches. If all ordered sandwich, the cost would be $139.5, so at most 15 sandwiches were ordered. You also know an even number of sandwiches was ordered, to let the price end at 50 cent.

If you brute-force from 4,6,8,10,12 to 14 sandwiches, you find the answer at 10 sandwiches and 8 soups.

10*7.75 + 8*4.50 = 113.50


User Vmeln
by
8.2k points