Answer to Question #333491 in Java | JSP | JSF for mahesh

Question #333491

Rob is fond of collecting coins but unfortunately,sometimes he has to sell a coin to get other coins.he puts all his coins one over the other in a column.

(0,i):Add coin with value i to the collection.

(1,0):sell a coin.

Selling a coin:For selling a coin ,he picks up the top coin in the coloumn if he constraint A is satisfied.Constraint A:Rob can only sell the coin if the coin collection value is more than Y.

Upon removal ,the coin collection value goes to the previous value.Initially,with 0 coins ,coin collection value is 0.

Adding a Coin:on adding a coin of value i to the collection the coin collection value increments via the following prodcedure.

If the coin collection had>=X value then current total value is X+i else X+2*i.

Rob needs to find and return the final value of coin collection after Q operations.

Note:Initially,the value X is 0 and not X.

Ex1:

i/p1:10(deciding increment)

i/p2:0(selling coins)

i/p3:1(no of operations)

i/p4:{{0,5}}

o/p:10




0
Service report
It's been a while since this question is posted here. Still, the answer hasn't been got. Consider converting this question to a fully qualified assignment, and we will try to assist. Please click the link below to proceed: Submit order

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 the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS