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 08:30
1.the index finger on your right hand types the f r v 4 j u m 7 h y 6 n lo.9 j u 7 m g t 5 b 2.if you need to multiply 400, 2, and 1 ½, what would you type on the numeric keypad? 400*2*1.5 400/2*1.5 400/2/1.5 400*2*1½ 3.select all examples of proper keyboarding technique. rest your fingers gently on the home row or home keys. slouch in your chair. rest your palms on the keyboard. relax your fingers. keep your hands lower than your elbows.
Answers: 1
question
Computers and Technology, 22.06.2019 22:30
You are new to microsoft certification and want to start out by getting a certification geared around windows 8. what microsoft certification should you pursue?
Answers: 1
question
Computers and Technology, 23.06.2019 00:00
Suppose you have 9 coins and one of them is heavier than others. other 8 coins weight equally. you are also given a balance. develop and algorithm to determine the heavy coin using only two measurements with the of the balance. clearly write your algorithm in the form of a pseudocode using the similar notation that we have used in the class to represent sorting algorithms
Answers: 1
question
Computers and Technology, 23.06.2019 04:31
Cloud computing service providers manage different computing resources based on the services they offer. which resources do iaas and paas providers not manage? iaas providers do not manage the for the client, whereas paas providers usually do not manage the for their clients. iaas- storage server operating system network paas- applications interafce storage vertualiation
Answers: 2
You know the right answer?
Algorithms that can correctly predict stock prices can help generate millions of dollars. In this on...
Questions
question
Mathematics, 24.01.2022 02:50
question
English, 24.01.2022 03:00
question
Mathematics, 24.01.2022 03:00