light oj 1004 水DP
来源:互联网 发布:storm编程 书籍下载 编辑:程序博客网 时间:2024/06/03 21:37
#include<iostream>#include<cstdio>#include<algorithm>#include<memory.h>using namespace std;int dp[300][300];int cun[300];int n;int main(){ int T; cin>>T; int u=0; while(T--) { memset(dp,0,sizeof(dp)); cin>>n; for(int a=1;a<=n;a++)cun[a]=a; int y=n-1; for(int a=n+1;a<=2*n-1;a++)cun[a]=y--; for(int a=1;a<=2*n-1;a++)for(int b=1;b<=cun[a];b++)scanf("%d",&dp[a][b]); for(int a=2*n-1;a>=n;a--) { for(int b=1;b<=cun[a];b++) { if(b==1)dp[a][b]+=dp[a+1][b]; else if(b==cun[a])dp[a][b]+=dp[a+1][b-1]; else dp[a][b]+=max(dp[a+1][b],dp[a+1][b-1]); } } for(int a=n-1;a>=1;a--)for(int b=1;b<=cun[a];b++)dp[a][b]+=max(dp[a+1][b],dp[a+1][b+1]); printf("Case %d: %d\n",++u,dp[1][1]); } return 0;}
毫无亮点…最垃圾的那种
0 0
- light oj 1004 水DP
- 【DP】 Light OJ 1004 Monkey Banana Problem
- Light oj 1004 - Monkey Banana Problem(DP)
- light oj 1032 数位DP
- light OJ 1205 数位DP
- light OJ 1068 数位DP
- light oj 1140 数位dp
- light oj 1422,区间dp
- Light OJ 1231(背包dp)
- light oj 1068(数位dp)
- light oj 1422(区间dp)
- light oj 1025 区间dp
- light oj 1032(数位dp)
- Light OJ 1038(概率DP)
- Light OJ 1031 区间dp
- light oj 1248 概率dp
- 区间DP :Light OJ 1031
- Light OJ 1004 - Monkey Banana Problem dp题解
- hashMap ,hashTable ,concurrentHashMap区别
- SimpleAdapter创建ListView
- centos7 开放端口
- SSLv3&TLS协议学习笔记(一)
- Design Patterns - Observer Pattern
- light oj 1004 水DP
- Java 并发:sleep,yield,join
- NOI题解(1.5编程基础之循环控制)(待补全)
- 设置ctl.start 属性启动init.rc 中service以及权限问题
- 关于appserv 中 php 安装php_imagic的问题
- java中按文件中的分隔符(空格、换行符等)逐项读取文件中的数据
- MySQL profiling 查找Query瓶颈
- Java微信二次开发之6-文本消息体内容换行的使用
- ToolBar