There are some staffs N given with certain ratings R(i) based on there performance. Now optimally maximum no. of staff has to be selected to meet certain Standard Rating (R). But Certain provisions are allowed for the staff selection procedure regarding the rating i.e. two or more staffs can be clubbed together to increase there rating via the no. of staffs clubbed implying that rating increases proportional to the no. of staffs clubbed.But remember a staff with lower rating will only go to the staff with higher rating to increase the rating of higher rated staff. Higher rated staff at max would go to the staff with equal rating but not with the lower rated staff.
Example: If there are 5 staffs with ratings R={2,5,6,7,18} respectively and the standard rating is 7. Find the Maximum credible staffs that can be selected.
Then the answer to this question would be : 3
Solution: The staff with rating 6 i.e. R(3) can be clubbed with R(2)=5 or R(1)=2 to increase its rating by 1 to achieve the standard rating R=7.
Notice: R(3) can be again clubbed with R(1) if previously clubbed with R(2) and vice versa but that's not required since its on standard rating and no other staff can be formed with standard rating.
I need Help in generalizing the answer i.e.( 3 in this case ) to all such problems. Thank you!
