Problem: Sanjay has m rupees, each chocolate costs c rupees, shopkeeper will give away k chocolates for w wrappers. Can you find now how many chocolates Sanjay will be able to eat?
Input: 4 integers separated by space in order m, c, w, k
integers c and w will be >0
integers m and k will be >=0
integer k will be <w
Output: An integer denoting number of chocolates Sanjay will be able to get.
Sample input:15, 2, 3, 1
Sample output:10
Explanation:
Sanjay has 15 rupees, buys 7 chocolates for 2 rupees each.
Sanjay now has 7 wrappers, exchanges 6 of them for 2 more chocolates.
Sanjay now has 3 wrappers and exchanges them for 1 more chocolate making a total of 10 chocolates
Published By : Vaibhav G. Khetal