Bank Account

Alice has 100 dollars in her bank account, and she wants to withdraw at least 10 dollars in the course of 7 days. However, the bank has a weird policy. On the i th i^\text{th} day, she will be paid p i p_i dollar if she doesn't withdraw any money. If she wants to withdraw, she can only withdraw exactly q i q_i dollars.

The table below describes p p and q q on the i th i^\text{th} day:

i 1 2 3 4 5 6 7
p 5 4 8 4 9 6 3
q 4 9 5 2 5 2 6

Assume that Alice cannot deposit any money, what is the maximum amount of money can Alice has in her bank account after 7 days?


The answer is 121.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

Francis Naldo
May 14, 2018

Let Bal be the balance in case of no withdrawal, Bal = 100 + i = 1 7 p i 100 + \sum_{i=1}^{7} p_{i} = 139

Next, get all possible combinations of q i q_{i} where sum is 10 \geq10 . Of course, we want to have the minimum number of q i q_{i} s.

(Without writing the algorithm used) the combination are as follows: + the loss for withdrawing

  • q 1 + q 2 q_{1} + q_{2} \Rightarrow (4+9) + (5+4) = 22
  • q 1 + q 3 + q 4 q_{1} + q_{3} + q_{4} \Rightarrow (4+5+2) + (5+8+4) = 28
  • q 1 + q 3 + q 5 q_{1} + q_{3} + q_{5} \Rightarrow (4+5+5) + (5+8+9) = 36
  • q 1 + q 3 + q 6 q_{1} + q_{3} + q_{6} \Rightarrow (4+5+2) + (5+8+6) = 30
  • q 1 + q 3 + q 7 q_{1} + q_{3} + q_{7} \Rightarrow (4+5+6) + (5+8+3) = 31
  • q 1 + q 4 + q 5 q_{1} + q_{4} + q_{5} \Rightarrow (4+2+5) + (5+4+9) = 29
  • q 1 + q 4 + q 6 + q 7 q_{1} + q_{4} + q_{6} + q_{7} \Rightarrow (4+2+2+6) + (5+4+6+3) = 32
  • q 1 + q 5 + q 6 q_{1} + q_{5} + q_{6} \Rightarrow (4+5+2) + (5+9+6) = 31
  • q 1 + q 7 q_{1} + q_{7} \Rightarrow (4+6) + (5+3) = 18 \Leftarrow Min

  • q 2 + q 3 q_{2} + q_{3} \Rightarrow (9+5) + (4+8) = 26

  • q 2 + q 4 q_{2} + q_{4} \Rightarrow (9+2) + (4+4) = 19
  • q 2 + q 5 q_{2} + q_{5} \Rightarrow (9+5) + (4+9) = 27
  • q 2 + q 6 q_{2} + q_{6} \Rightarrow (9+2) + (4+6) = 21
  • q 2 + q 7 q_{2} + q_{7} \Rightarrow (9+3) + (4+6) = 22

  • q 3 + q 5 q_{3} + q_{5} \Rightarrow (5+5) + (8+9) = 27

  • q 3 + q 7 q_{3} + q_{7} \Rightarrow (5+6) + (8+3) =22

  • q 4 + q 6 + q 7 q_{4} + q_{6} + q_{7} \Rightarrow (2+2+6) + (4+6+3) = 23

Note: There might be some other combinations but are not written because they are redundant. For example, a 1 + a 2 + a 3 10 a_{1} + a_{2} + a_{3} \geq10 and a 1 + a 3 10 a_{1} + a_{3} \geq10 . The extra addend on the first expression is unnecessary because we are looking the minimum loss.

Now, B a l M i n 139 18 = 121 Bal - Min \implies 139 - 18 = 121

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...