68 425
Assignments Done
98,6%
Successfully Done
In December 2018

Answer to Question #38802 in C++ for Ahsan

Question #38802
You have a block of platinum that can be exchanged in your bank either for cash or for smaller blocks of platinum.if you exchange a block of 'm' grams ,you get three blocks of weight m/2,m/3 and m/4 grams each. you don't get any fractional part ,as the division process rounds down the value. if you exchange the block of platinum for cash, you get 'm' units of currency. You can do any number of exchanges for smaller blocks or currency.
Given the value of a block in grams as input, write a program that would print the largest possible currency value that you can receive as the out put. Assume that the maximum value of a block that can be given as an input is 1,000,000,000 grams ans the minimum value is 2 grams.

Sample input 1:
12
Sample output 1:
13
Explanation: you can change 12 into blocks of 12/2=6, 12/3=4, and 12/4=3 and then exchange these for 6+4+3=13 units of currency
SAMPLE INPUT 2:
2
SAMPLE OUTPUT 2:
2
EXPLANATION: if you exchange 3 grams into smaller blocks, it gives 2/2=1,2/3=0and2/4=0 only 1 unit.
Expert's answer
Dear customer,
Unfortunately, your question requires a lot of work and cannot be done for free.
Please submit it with all requirements as an assignment to our control panel and
we'll assist you.

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions