Problem 43078. How many bottles can you drink?
Sometimes if you buy a drink in a glass bottle you can return that bottle and get some money back.
Let's assume we have "x" amount of money, the drink cost "p" per bottle, and we get "c" back money for each bottle.
If we have enough time, how much can we buy drinks for "x" money?
Example
We have $10, drink costs $1, for each bottle we return we get $0.35
Step I: We buy 10 drinks We get $3.50 back for bottles
Step II: We buy 3 drinks and we are left with $0.50 We get back $1.05 back so we have $1.55
Step III: We buy 1 drink and we have $0.55 We get $0.35 for bottle, so we have $0.90 and we can't buy another drink for that.
Summary for $10 we were able to drink 14 bottles.
Solution Stats
Problem Comments
-
1 Comment
Jean-Marie Sainthillier
on 3 Nov 2017
Good problem but add more tests please.
Solution Comments
Show commentsProblem Recent Solvers76
Suggested Problems
-
Project Euler: Problem 10, Sum of Primes
1714 Solvers
-
424 Solvers
-
578 Solvers
-
Find the index of the largest value in any vector X=[4,3,4,5,9,12,0,4.....5]
375 Solvers
-
Finding perimeter of a rectangle
455 Solvers
More from this Author12
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!