9711313 | CodeChef

I don’t understand the example output (perhaps I also don’t understand the prompt). In the first test case:

3
4 6 8
2 6 6
1 4 3

On the second line: Si = 4, Pi = 6, Vi = 8. This means that there are 4 stores, 6 people who will buy food that day, and each piece of food costs 8. The number of people per store who will buy food is floor(Pi/Si). So the daily profit for this food item is floor(6/4) * 8 = 8.

On the second line: Si = 2, Pi = 6, Vi = 6. This means that there are 2 stores, 6 people who will buy food that day, and each piece of food costs 6. So the daily profit for this food item is floor(6/2) * 6 = 18.

The third line, the daily profit is floor(4/1) * 3 = 12.

So why is 18 not the answer?

Oh … I decided to check one solution and Si count doesn’t include the chef’s store. The actual number of stores is Si + 1. That’s stupid.