Winning CB Scholarship

Why the output is 25 for the input :
n=55, m=20, x=2, y=1

as with 20 discount coupons you have you can give scholarship to 10 students as x=2, now if 30 students performs badly you will get 30 discount coupon which can be used to give scholarship to remaining 15 students this total students getting scholarship are 10+15

In case of any doubt feel free to ask :slight_smile:
mark your doubt as RESOLVED if you got the answer

How do we know that 30 students performed badly, it is not given anywhere?

you need to find maximum number of students who can get scholarship so you can consider any possiblity , any combination of student passing or failing , if 30 students fail we can have 25 students to get scholarship , this provides the best situation for us

But why didn’t the same happen in case of n=10, m=3,x=1,y=1; we could have given 3 scholarships to 3 students and then 10-3=7, it means 7 students failed and we can give scholarships to 7 more students?

you only have 10 students so if you give scholarship to 3 students and fail 7 students then you don’t students to given scholarship

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.