subject

Algorithms that can correctly predict stock prices can help generate millions of dollars. In this one-player game, you try to predict the rise and fall of the stock price of various stocks and buy or sell the stocks accordingly. You start with $100. Each turn you will be given the stock prices of current day and previous 4 days. You must then choose to BUY or SELL the stocks. Your program will be run with input for 1 day at a time.
The stock prices are generated by us and may contain patterns.
Input Format
The input of each turn will consist of multiple lines. All money values are doubles to two decimal places, all other numbers are integers.
The first line contains three space separated numbers m k d.
m - the amount of money you could spend that day.
k - the number of different stocks available for buying or selling.
d - the number of remaining days for trading stocks.
k lines follow, each in the following format: name owned prices
name - the name of the stock (a string).
owned - the number of shares you own of that stock.
prices - 5 space separated numbers representing the stock's price for the last 5 days. These are ordered from oldest to newest, so the last number is the current stock price.
Your program will be fed the days sequentially so you can write to a file in order to store a longer history of the prices.
Output Format
The output for each turn should also contain multiple lines:
Output N for the number of transactions you wish to make. Output 0 if you are not making any transactions that day.
If you are making transactions, output N lines containing the name of the stock (case sensitive), BUY or SELL, and the number of shares you wish to buy or sell.
NOTE: Money earned from selling stocks will only become available (for buying stocks) on the following day.
Sample Input 90 2 400
iStreet 10 4.54 5.53 6.56 5.54 7.60
HR O 30.54 27.53 24.42 20.11 17.50
Sample Output iStreet SELL 10 HR BUY 5

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 20:30
What is the biggest difference between section breaks and regular page breaks
Answers: 1
question
Computers and Technology, 23.06.2019 23:40
Which of the following calculates the total from the adjacent cell through the first nonnumeric cell by default, using the sum function in its formula? -average -autosum -counta -max
Answers: 1
question
Computers and Technology, 24.06.2019 04:30
The ieee 802.11: defines standards for wireless local area network (wlan) communication protocols. identifies various computers or devices connected to a network. verifies any resource attached to another computer on a network that is different from the computer to which the user is logged on. connects multiple local area networks (lans) and wide area networks (wans).
Answers: 2
question
Computers and Technology, 24.06.2019 05:50
What all vehicles has tesla inc. created over the years
Answers: 3
You know the right answer?
Algorithms that can correctly predict stock prices can help generate millions of dollars. In this on...
Questions
question
Mathematics, 03.02.2021 16:30
question
Mathematics, 03.02.2021 16:30
question
Mathematics, 03.02.2021 16:30
question
English, 03.02.2021 16:30
question
English, 03.02.2021 16:30
Questions on the website: 13722359