Assume that there are certain types of investment projects that can increase your money. Let's assume that project i need investment a; to be done. Once the project is established, it returns your initial investment and gives you an additional profit b₁. Each project may be established once. Currently you have an amount of money equal p. Note that you can't establish a project that takes more money than what you currently have. Your task is to find the maximum possible profit out of these projects. Input The first line contains the integers n and p, where n is the number of available projects and p is your initial amount of money. Then two lines follow, each containing n integers describing the arrays a and b [Note: a;: the amount of money that you have to invest (spend) to establish the project i. b;: the amount of revenue that you get as an addition to the amount of money already spent to establish the project i. Output For each test case, output a single value that present the maximum profit you can achieve. Example Ex1 np a; → Ex3 b; → Ex2 np a; → bi → np a; → bi → input 5 $200 $200 $200 $500 $200 $200 $200 $200 $200 $200 $200 3 $150 $200 $400 $150 $90 $1000 $50 5 $80 $1280 $640 $320 $160 $80 $1280 $640 $320 $160 $80 output $1000 $140 $2480
Assume that there are certain types of investment projects that can increase your money. Let's assume that project i need investment a; to be done. Once the project is established, it returns your initial investment and gives you an additional profit b₁. Each project may be established once. Currently you have an amount of money equal p. Note that you can't establish a project that takes more money than what you currently have. Your task is to find the maximum possible profit out of these projects. Input The first line contains the integers n and p, where n is the number of available projects and p is your initial amount of money. Then two lines follow, each containing n integers describing the arrays a and b [Note: a;: the amount of money that you have to invest (spend) to establish the project i. b;: the amount of revenue that you get as an addition to the amount of money already spent to establish the project i. Output For each test case, output a single value that present the maximum profit you can achieve. Example Ex1 np a; → Ex3 b; → Ex2 np a; → bi → np a; → bi → input 5 $200 $200 $200 $500 $200 $200 $200 $200 $200 $200 $200 3 $150 $200 $400 $150 $90 $1000 $50 5 $80 $1280 $640 $320 $160 $80 $1280 $640 $320 $160 $80 output $1000 $140 $2480
Operations Research : Applications and Algorithms
4th Edition
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Wayne L. Winston
Chapter11: Nonlinear Programming
Section11.13: Pareto Optimality And Tradeoff Curves
Problem 5P
Related questions
Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 4 images