The problem is chef and street food. can any body explain why we take Si / Vi * Pi
You should at least share something like problem link or editorial link where you have problem.
Problem is very simple but I don’t know by Si,Vi and Pi is referring to.
I think you haven’t consider the input order which is Si,Pi and Vi.
profit by opening store for ith type of food will be =Pi/(Si+1)*Vi
final answer will be (maximum over all types)
there are already Si stores chef opens another one hence total stores offering ith type of food is Si+1.
People interested from buying chef’s store are Pi/(Si+1)
and total profit will be (no. of people)*Vi
My solution link:
If you still has doubt Here is editorial link
i have used the same formula as in editorial .
As I have assumed you are taking inputs in wrong order
and you are also neglecting the order of arithmetic operators which is
/ > * > + > -
it should be value*(people/(stores+1)) or value*people/(stores+1).
Take a look I have corrected it