1578: [Usaco2009 Feb]Stock Market 股票市场

1578: [Usaco2009 Feb]Stock Market 股票市场

Time Limit: 10 Sec   Memory Limit: 64 MB
Submit: 507   Solved: 269
[ Submit][ Status][ Discuss]

Description

尽管奶牛们天生谨慎,她们仍然在住房抵押信贷市场中受到打击,现在她们开始着手于股市。 Bessie很有先见之明,她不仅知道今天S (2 <= S <= 50)只股票的价格,还知道接下来一共D(2 <= D <= 10)天的(包括今天)。 给定一个D天的股票价格矩阵(1 <= 价格 <= 1000)以及初始资金M(1 <= M <= 200,000),求一个最优买卖策略使得最大化总获利。每次必须购买股票价格的整数倍,同时你不需要花光所有的钱(甚至可以不花)。这里约定你的获利不可能超过500,000。 考虑这个牛市的例子(这是Bessie最喜欢的)。在这个例子中,有S=2只股票和D=3天。奶牛有10的钱来投资。 今天的价格 | 明天的价格 | | 后天的价格 股票 | | | 1 10 15 15 2 13 11 20   以如下策略可以获得最大利润,第一天买入第一只股票。第二天把它卖掉并且迅速买入第二只,此时还剩下4的钱。最后一天卖掉第二只股票,此时一共有4+20=24的钱。

Input

* 第一行: 三个空格隔开的整数:S, D, M

* 第2..S+1行: 行s+1包含了第s只股票第1..D天的价格

Output

* 第一行: 最后一天卖掉股票之后最多可能的钱数。

Sample Input

2 3 10
10 15 15
13 11 20

Sample Output

24

HINT

Source

Gold


背包dp

涨姿势了,无需多开维度记录当前已有股票数目,只考虑今天买明天卖即可。
原因:今天买后天卖  等价于   今天买明天卖明天买后天卖   

每日背包即可

附代码:
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<string>
#include<climits>
#include<queue>
#define N 55
#define M 1000002
using namespace std;
int s,d,m;
int mp[N][N],f[M];
int main()
{
	scanf("%d%d%d",&s,&d,&m);
	for(int i=1;i<=s;i++)
		for(int j=1;j<=d;j++)
			scanf("%d",&mp[i][j]);
	for(int i=1;i<d;i++)
		{
			memset(f,0,sizeof(f));
			for(int j=1;j<=s;j++)
				for(int k=mp[j][i];k<=m;k++)
					f[k]=max(f[k],f[k-mp[j][i]]-mp[j][i]+mp[j][i+1]);
			m+=f[m];
		}printf("%d\n",m);
}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
We offer a systematic analysis of the use of deep learning networks for stock market analysis and prediction. Its ability to extract features from a large set of raw data without relying on prior knowledge of predictors makes deep learning potentially attractive for stock market prediction at high frequencies. Deep learning algorithms vary considerably in the choice of network structure, activation function, and other model parameters, and their performance is known to depend heavily on the method of data representation. Our study attempts to provides a comprehensive and objective assessment of both the advantages and drawbacks of deep learning algorithms for stock market analysis and prediction. Using high-frequency intraday stock returns as input data, we examine the effects of three unsupervised feature extraction methods—principal component analysis, autoencoder, and the restricted Boltzmann machine—on the network’s overall ability to predict future market behavior. Empirical results suggest that deep neural networks can extract additional information from the residuals of the autoregressive model and improve prediction performance; the same cannot be said when the autoregressive model is applied to the residuals of the network. Covariance estimation is also noticeably improved when the predictive network is applied to covariance-based market structure analysis. Our study offers practical insights and potentially useful directions for further investigation into how deep learning networks can be effectively used for stock market analysis and prediction.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值