Monkey Banana Problem LightOJ - 1004

错误记录:

1.数组开小
2.每组数据数组没有清空

 #include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int T,TT,n;
int a[][],ans[][];
int main()
{
int i,j;
scanf("%d",&T);
for(TT=;TT<=T;TT++)
{
memset(a,,sizeof(a));
memset(ans,,sizeof(ans));
scanf("%d",&n);
for(i=;i<=n;i++)
for(j=;j<=i;j++)
scanf("%d",&a[i][j]);
for(i=;i<n;i++)
for(j=;j<=n-i;j++)
scanf("%d",&a[i+n][j]);
ans[][]=a[][];
for(i=;i<=n;i++)
{
ans[i][]=ans[i-][]+a[i][];
for(j=;j<=i;j++)
ans[i][j]=max(ans[i-][j],ans[i-][j-])+a[i][j];
}
for(i=;i<n;i++)
for(j=;j<=n-i;j++)
ans[i+n][j]=max(ans[i+n-][j],ans[i+n-][j+])+a[i+n][j];
printf("Case %d: %d\n",TT,ans[n*-][]);
}
}

Monkey Banana Problem LightOJ - 1004的更多相关文章

  1. (LightOJ 1004) Monkey Banana Problem 简单dp

    You are in the world of mathematics to solve the great "Monkey Banana Problem". It states ...

  2. Light oj-1004 - Monkey Banana Problem,数字三角形的变形版~

                                                                                                     100 ...

  3. F - Monkey Banana Problem

    F - Monkey Banana Problem Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%lld & ...

  4. Lightoj 1004 - Monkey Banana Problem

    题目链接:http://acm.hust.edu.cn/vjudge/contest/121396#problem/F http://lightoj.com/volume_showproblem.ph ...

  5. Light OJ 1004 - Monkey Banana Problem(DP)

    题目大意: 给你一菱形的数字阵,问从最上面走到最下面所能获得的最大值是多少? #include<cstdio> #include<cstring> #include<io ...

  6. [LightOJ1004]Monkey Banana Problem(dp)

    题目链接:http://lightoj.com/login_main.php?url=volume_showproblem.php?problem=1004 题意:数塔的变形,上面一个下面一个,看清楚 ...

  7. 2016huasacm暑假集训训练五 F - Monkey Banana Problem

    题目链接:http://acm.hust.edu.cn/vjudge/contest/126708#problem/F 题意:求至上而下一条路径的所经过的值得和最大值,这题比赛时就出了 但当时看不懂题 ...

  8. lightoj 1004 dp:数字三角形

    题目链接:http://lightoj.com/volume_showproblem.php?problem=1004 #include <cstdio> #include <cst ...

  9. lightoj 1004

    很水的一个dp #include<cstdio> #include<iostream> #include<cstring> #include<algorith ...

随机推荐

  1. JavaScript Prototype in Plain Language

    非常好的文章: http://javascriptissexy.com/javascript-prototype-in-plain-detailed-language/ jan. 25 2013 14 ...

  2. LightRoom操作快捷键

    1.隐藏与释放上下左右面板:F5.F6.F7.F8.分别对应上下左右面板.tab键可以隐藏与释放左右面板,shift+table可以同时隐藏与释放所有面板,T键隐藏与显示工具栏 2.图库与修改照片模块 ...

  3. Download Software Top 10

    We are quite rich in terms of web browsers! Nevertheless, it's a bit surprising to know that even so ...

  4. react 从零开始搭建开发环境

    1.创建 package.json 项目 npm init 2.安装 webpack, 并且设置为项目依赖: npm install webpack --save-dev 当然你必须之前已经在 -g ...

  5. A Single Channel with Multiple Consumers RabbitMQ

    http://stackoverflow.com/questions/30696351/a-single-channel-with-multiple-consumers-rabbitmq up vot ...

  6. 使用literal语法格式化字符串

    支持arm64之后,格式化字符串的时候会遇到一些问题,主要与NSInteger的定义有关: #if __LP64__ || (TARGET_OS_EMBEDDED && !TARGET ...

  7. 一个关于MYSQL IFNULL的用法

    select a.receiveID,(a.num - IFNULL(b.num,0)) as num from (SELECT num,receiveID from dog_giftnumrecor ...

  8. c++代码赏析之类对象传參

    #include <iostream> using namespace std; class A { private: int x; public: A():x(0) { x = 0; c ...

  9. Android 4.4.2 动态加入JNI库方法记录 (二 app应用层)

    欢迎转载,务必注明出处:http://blog.csdn.net/wang_shuai_ww/article/details/44458553 源代码下载地址:http://download.csdn ...

  10. PHP 7.2 RC3 on CentOS/RHEL 7.3 via Yum

    https://webtatic.com/packages/php72/ rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-lat ...