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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 23:30, huangjianhe135
The keyboard usually has six rows of keys. which of the following is not one of the key group categories? letter keys number keys control keys graphic keys
Answers: 1
image
Computers and Technology, 24.06.2019 07:00, jordaaan101
Guys do you know sh27 cause he hacked me : ( pidgegunderson my old user
Answers: 2
image
Computers and Technology, 24.06.2019 11:20, davionb556
William travels a lot on business purpose. he needs to regularly communicate with his business partner. he also needs to send out weekly reports to his boss while he is traveling. which web-based application best suits william’s needs? (social media, webmail, wiki) is the best web-based application for william. he can access this application via the internet using a (digital cable, fax machine, web browser).
Answers: 1
image
Computers and Technology, 24.06.2019 23:00, amandajennings01
Why is it preferable to code web pages in html format? a. to create more lines code b. to apply general formatting rules c. to display properly as search results in all browsers d. to add meaning to the document
Answers: 1
You know the right answer?
Algorithms that can correctly predict stock prices can help generate millions of dollars. In this on...

Questions in other subjects:

Konu
Mathematics, 05.05.2020 19:04
Konu
Mathematics, 05.05.2020 19:04
Konu
English, 05.05.2020 19:05