Beans
来源:互联网 发布:淘宝网商家注册 编辑:程序博客网 时间:2024/05/23 22:49
http://acm.hdu.edu.cn/showproblem.php?pid=2845
#include<stdio.h>
int dp[200010],a[200010],b[200010];
#define max(x,y) x>y?x:y
int main()
{
int n,m,i,j;
while(scanf("%d%d",&n,&m)!=EOF)
{
dp[0]=a[0]=b[0]=0;
for(i=1;i<=n;i++)
{
for(j=1;j<=m;j++)
scanf("%d",&a[j]);
dp[1]=a[1];
for(j=2;j<=m;j++)
dp[j]=max(dp[j-2]+a[j],dp[j-1]);
b[i]=dp[m];
}
dp[1]=b[1];
for(i=2;i<=n;i++)
dp[i]=max(dp[i-2]+b[i],dp[i-1]);
printf("%d\n",dp[n]);
}
return 0;
}
0 0
- Beans
- Beans
- 企业Beans Enterprise Beans
- 企业Beans Enterprise Beans
- java beans
- Java Beans
- beans.xml
- XML Beans
- Managed Beans
- spring beans
- hdu2845 Beans
- spring beans
- beans.xml
- beans配置
- HDU2845--Beans
- beans.xml
- Managed Beans
- beans.xml
- android-async-http使用一个参数上传多个文件
- 风景的康复的健康风景
- catalina.out文件过大
- POJ 1305 Fermat vs. Pythagoras (本原毕达哥拉斯三元组)
- openfire杂项(小而重要)
- Beans
- 我的编程感悟[2016/5/24更新]
- Uncompressing Linux... done, booting the kernel.
- 2. 网友对app后端写作系列文章的写作建议
- PHP开源项目使用Travis CI进行持续集成
- centos6.4 linux 下安装git服务器
- 拍了哦人民蝶飞
- VC++的链接错误LNK2005
- 二分查找