Stuck how to approach this problem.

Revision en2, by rishabh1322, 2018-11-21 20:37:06

Can anyone tell me how to approach this problem ....

Suppose there are given N person each having exactly one candy at initial. Each person gives candy to another person with a factor which decides a cost for buying that candy by another person. You have to maximize candy for a given person with minimum cost. We have to maximize candies for a given person in such a way that the no. of candies for that person is maximum by at least 1 candy from all other persons.

Example:- Suppose there are 5 persons and you have to maximize candies for 1 person then

Candy given from person1 to person2 with cost for buying that is:

Person1 person2 Cost 1 2 12 2 5 28 3 4 18 4 5 42 5 3 18

For the optimum solution, Person 1 can buy candy from person 2 with cost 12 and person 5 with cost 18. So he has 2 candies which are maximum for 5 persons.

Thanks...

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English rishabh1322 2018-11-21 20:37:06 0 (published)
en1 English rishabh1322 2018-11-21 20:36:02 1019 Initial revision (saved to drafts)