1
$\begingroup$

I have two tuples - first tuple (A,B) where A and B are positive integers and one other tuple which is (0,0) initially. Input tuple remains fixed but the output tuple can be changed. I have to maximize the value of second term in the second tuple. Increment can be done in only these ways -

increase 1st term of 2nd tuple by 1 which decreases A by 1

increase 2nd term of 2nd tuple by the value in the 1st term of 2nd tuple which decreases A by B

A can be reduced to minimum 0. e.g. (A,B) = (10,2) Output Input (0,0) (10,2) (1,0) (9,2) (2,0) (8,2) (3,0) (7,2) (4,0) (6,2) (4,4) (4,2) (4,8) (2,2) (4,12) (0,2)

So the answer is 12. Can do the operations in any ways maximum value that can be attained by the second term is 12. What is the general procedure to solve this problem. I am stuck. Please help

$\endgroup$
  • $\begingroup$ If you increase 1st term of 2nd tuple first and then tried to increase 2nd term of 2nd tuple then the best approach is to make 1st term of 2nd tuple as close as possible to $\frac{A}{2}$. $\endgroup$ – Ahmad Jul 10 '17 at 22:49
  • $\begingroup$ $\{225 ,112 ,75 ,56 ,45 ,36 ,32 ,28 ,24 ,20 ,19 ,18 ,17 ,16 ,15 ,14 ,13 ,12 ,11 ,10 ,9 ,8 ,7 ,6 ,5 ,4 ,3 ,2 ,1 \}$ maximum value for $A=30$ and $1 \leq B \leq 29$ from left to right. $\endgroup$ – Ahmad Jul 10 '17 at 23:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.