You are on page 1of 1

/******************************************************************************

Online C++ Compiler.


Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/
def Books(input1,input2, input3[],input4[]):
if input1 == 0 or input2 == 0:
return 0

if (input4[input1-1] > input2):


return Books(input1-1,input2,input3,input4)
else:
return max(input3[input1-1] +Books(input1-1,input2-input4[input1-1],
input3,input4),Books(input1-1,input2,input3,input4))

You might also like