Given a rod of length n inches and an array of prices that contains prices of all pieces of size smaller than n. Determine the maximum value obtainable by cutting up the rod and selling the pieces.
First line consists of T test cases. First line of every test case consists of n, denoting the size of array. Second line of every test case consists of price of ith length piece.
For each testcase, in a new line, print a single line output consists of maximum price obtained.
1 <= T <= 100
1 <= n <= 100
1 <= Ai <= 100
1 5 8 9 10 17 17 20
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.