Didn't understand chef and street food

Hey, please anyone explain the problem statement chef and street food. I can’t get it clearly.

2 Likes

You will be given no. of shops, price and no. of people. We assume that no. of people will be equally split among all the shops. So, naturally profit will be no. of people visiting chef’s shop multiplied by cost of item. Now, you have to just print maximum profit possible. :slight_smile:

2 Likes

Thank you. i understood🙂

1 Like

The number of shops includes the chefs shops? Can you please explain the first example case if possible

i am also not getting question can anyone explain me?

No, the number of shops doesn’t include chef’s shop.
In the first example case, chef choose 2nd type of food and the cost to that is;
cost=(p/(s+1))*v.

2 Likes

/* package codechef; // don’t place package name! */

import java.util.;
import java.lang.
;
import java.io.*;

/* Name of the class has to be “Main” only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner scan = new Scanner(System.in);
int t = scan.nextInt();

	for(int z=0;z<t;z++){
	    int n = scan.nextInt();
	    int biggest = 0;
	    for(int i=0;i<n;i++){
	         int s = scan.nextInt();
	         int p = scan.nextInt();
	         int v = scan.nextInt();
	         int cost = 0;
	         cost = (p/(s+1))*v;
	         biggest = Math.max(cost,biggest);
	    }
	    System.out.println(biggest);
	}
}

}
// first test case
//s=2 p=6 v=6
//chef wants to create a new store
// new values are after creating a new store is s=3 p=6 v=6
//as chef wants to distribute people equally among all stores
// so at each store 2 people visit
// at each store 2 people * price is 6 so 2*6=12
//so maximum price is 6
// as shown in second test case

1 Like