Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Contest planning for highest score in JAVA Knapsack in JAVA!! INPUT and OUTPUT files ContestA.in 4 10 2 4 3 5 4 6 6 7

Contest planning for highest score in JAVA

Knapsack in JAVA!!

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

INPUT and OUTPUT files

ContestA.in

4 10 2 4 3 5 4 6 6 7

ContestA.output

contestA.in has 4 problems over 10 hours Pr# Time Points 1 2 4 2 3 5 3 4 6 4 6 7

The selected problems for the highest contest score are: Problem Points 1 4 2 5 3 6

Target problem list yields 15 points

ContestB.in

6 12 2 5 3 6 2 4 5 3 1 1 7 8

ContestB.output

contestB.in has 6 problems over 12 hours Pr# Time Points 1 2 5 2 3 6 3 2 4 4 5 3 5 1 1 6 7 8

The selected problems for the highest contest score are: Problem Points 1 5 2 6 6 8

Target problem list yields 19 points

ContestC.in

7 10 4 3 2 4 5 9 1 1 3 3 7 8 6 7

ContestC.output

contestC.in has 7 problems over 10 hours Pr# Time Points 1 4 3 2 2 4 3 5 9 4 1 1 5 3 3 6 7 8 7 6 7

The selected problems for the highest contest score are: Problem Points 2 4 3 9 5 3

Target problem list yields 16 points

1 Objective The rules for a new type of programming contest provides a list of problems, their respective score in integer points, and a statistically valid estimate of the time it takes to solve the problem. This duration or time is expressed in integer hours. To help with a solution strategy the contest organizers reveal there is a dynamic programming solution enabling all the contestants to maximize their score and stay within the time limits for the contest. One of the rules' drawback is that the duration of the contest and the problem data is not announced until just before the contest start. Another drawback is that once a problem has been started it must be finished within the timeframe, otherwise there is no score credit for the problem being attempted.There is no penalty for finishing early and there is no benefit either, as the time gained cannot be applied to another problem. It is, however, acceptable to continue on to the next problem in the solution list generated from the dynamic program. The assignment is to build the dynamic program that creates the optimum problem list for the given number of problems and timeframe. 2 Requirements Read the input file formatted as follows. The input file will contain the following data, in the order shown below Input Data Description Number of problems 10 2 3 umber of hours Hours & points per problem per prob- lem, repeating for up to 10 problems Table 1: Input file data layout 2.1 Functions Input Read input file passed as the first command line argument with one line each for the following: Number of problems an integer between 1 and 10 'The data in the file will be in the order shown above, tat is, problems, # contest hours, and up to 10 occurences of the problem time and problem points

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Students also viewed these Databases questions

Question

Find the derivative of y= cos cos (x + 2x)

Answered: 1 week ago

Question

How do Excel Pivot Tables handle data from non OLAP databases?

Answered: 1 week ago