At a certain theme park there are n rides, numbered from1 ton.
Before you can go on ride i you must pay its cost C[i] dollars,plus a
deposit, D[i] dollars. This means you must have at leastC[i]+D[i] dollars to
go on the ride. Once you have finished the ride, D[i] dollarsare returned to
you, as long as you did not damage the ride!
Careful Cheryl never damages any rides, and currently has Tdollars on her.
Cheryl would like to know the maximum number of different ridesshe can go
on. She can go on rides in any order she chooses.
You may assume C[1…n] and D[1…n] are both positive
PayPal Gateway not configured
PayPal Gateway not configured