# Chef wants to play [closed]

You are very hungry and decide to visit a restaurant with a couple of friends. You want to order three dishes for the three of you. But, the chef serves you only if the total cost of the dishes selected by you is a multiple of the cost of exactly one of the dishes selected. You get lucky and you quickly selected 3 dishes satisfying the above criteria. What are the total number of possible ways to select the same? You have your laptop with you and menu containing 500 dishes is provided to you in excel format( You can use a random generator in excel for price between 1-100\$(both included) ** Please note that No same dish can be selected

• Is this a codechef problem? – Certainly not a dog Oct 2 at 16:15

Let the price of one of the dishes be $$\x$$, and the other two be $$\(x+y_1)$$ and $$\(x-y_2)$$. We have $$3x +y_1 - y_2 = nx$$
$$\implies 3 + {y_1 - y_2\over x} = n$$ $$\implies y_1-y_2 \bf{~is~a~ multiple~ of ~}$$ $$x.$$
So, given any meals of price $$x$$, choose any other meal of price $$x+y_1$$. The expected number of such meals is $$5(100-x)$$. Now, the multiples of $$x$$ above our range is $$\left[{\frac{500}x}\right]$$. These are our number of choices for $$y_1 - y_2$$. So, we may count the choices for $$y_2$$ given a choice from $$y_1$$ in our earlier calculation, take the product of the counts, and sum from $$x = 1$$ to $$x = 100$$.