Skip to content

This determines what is the largest value that can be achieved in an interval [0, X], starting with an integer V and summing or subtracting integers from a vector S (without changing it's order)

Notifications You must be signed in to change notification settings

vieira-giulia/dynamicProgramming-choiceToBet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dinamicProgramming-choiceToBet

dinamic Programming - choice algorithm for bet game Bet games are based on choosing. This solves one type of bet game: here we start with an integer V inside an interval [0, X] and the player needs to choose if they are going to sum or subtract the next value to the current amount. The goal is to acquire the largest number possible, but never leave the interval. If you get something higher than a minimum M, you win.

The entry here needs to be a txt file like this:

N //the number of test cases that are used in this entry

S V X M //the size of the vector, the initial value, the max value and the minimum value to win

a1 a2 ... aS //the sequence of values in the vector //the last two lines repeat N times with different values

The output is S if you can win the game or N if you cannot, followed by the largest value you can achieve here.

This was also a college project.

About

This determines what is the largest value that can be achieved in an interval [0, X], starting with an integer V and summing or subtracting integers from a vector S (without changing it's order)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published