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, 22.06.2019 20:00
The blank button automatically displays next to the data when you select a range of numeric data which is an available option for creating a chart
Answers: 3
question
Computers and Technology, 23.06.2019 13:30
What is the primary difference between the header section of a document and the body? a. the body is displayed on the webpage and the header is not. b. the header is displayed on the webpage and the body is not. c. the tag for the body is self-closing, but the tags for the headers must be closed. d. the tag for the header is self closing, but the tag for the body must be closed.
Answers: 3
question
Computers and Technology, 23.06.2019 14:30
Select the correct answer. a company wants to use online methods to target more customers. it decides to conduct a market research by collecting the data of a few customers with their consent. they want to track data of the sites that their customers frequently visit. which software can the company? a. spyware b. bots c. adware d. trojan horse e. rootkits
Answers: 1
question
Computers and Technology, 23.06.2019 19:30
What are loans to a company or government for a set amount of time
Answers: 1
You know the right answer?
Algorithms that can correctly predict stock prices can help generate millions of dollars. In this on...
Questions
question
Health, 28.07.2019 20:30
question
Social Studies, 28.07.2019 20:30
Questions on the website: 13722361