POJ 1163 The Triangle (简单 DP 数字的最大路线和)

JS逆向实战:解密大众点评mtgsig的算法核心与补环境策略 本文深入解析大众点评mtgsig参数的JS逆向实战技巧,包括加密入口定位、AES加密算法还原及补环境策略对比。通过详细的技术分析和代码示例,帮助开发者掌握核心加密逻辑,提升爬虫开发效率与安全性。 阅读详情

题目大意:从三角形顶部数字走,每次只能走到这个数字的左下角或者右下角的数字,直到底部,计算走过的线路的数字之和,求这个和的最大值。


#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

const int MAXN = 105;

int dp[MAXN][MAXN], a[MAXN][MAXN];

int main()
{
    int n;
    while( cin>>n )
    {
        int i, j;
        int ans=0;
        for( i=1; i<=n; ++i )
            for( j=1; j<=i; ++j )
                cin >> a[i][j];

        memset( dp, 0, sizeof(dp));

        for( i=1; i<=n; ++i )
        {
            for( j=1; j<=i; ++j )
            {
                dp[i][j]=max( dp[i-1][j-1], dp[i-1][j] )+a[i][j];
                ans=max( ans, dp[i][j] );
            }
        }

        cout<<ans<<endl;
    }
    return 0;
}


基因家族的鉴定-基于Windows系统上的HMMER 基因家族的鉴定-基于Windows系统上的HMMER。 阅读详情

相关推荐

VxWorks环境搭建与学习:vxworks6.8和workbench3.2

VxWorks操作系统是美国WindRiver公司于1983年设计开发的一种嵌入式实时操作系统(RTOS),是嵌入式开发环境的关键组成部分。良好的持续能力、高性能的内核以及友好的用户开发环境,在嵌入式实时操作系统领域占据一席之地。它以其良好的可靠性和卓越的实时性被广泛地应用在通信、军事、航空、航天等高精尖技术及实时性要求极高的领域中,如卫星通讯、军事演习、弹道制导、飞机导航等。

qq_41854911的博客 8469

【DP】数字转换 dp求树的最长链问题

蓝本书P308 mx1存最大 mx2存次大 mx1[i]+mx2[i]是经过i点的最长链(一半加一半) 关于西街(细节): first_deal()里面的j循环必须从2开始 从1开始会重复计算 比如i=1 j=2和i=2 j=1重复 构建数的思想过程(敲黑板) #include<iostream> #include<cstdio> #include<cm...

玄兮小黑的博客 556

如何在Tagetik系统中抽取处理SAP系统财务数据

如何在Tagetik系统中抽取处理不同核算系统财务数据:以SAP为例,简单讲一下Tagetik对接SAP数据的基本情况

2201_75401663的博客 578

POJ-1163 The Triangle 「数字三角形」(递推)

刚刚使用DFS+记忆化搜索解决了数字三角形

JSure的代码库 1417

基于Claude AI的Dex个人操作系统:从零部署到高效工作流实战

在当今信息过载的时代,个人知识管理(PKM)和任务自动化成为提升效率的关键技术。传统PKM工具如Notion、Obsidian虽然提供了强大的信息存储能力,但本质上是被动的数据库,需要用户手动维护结构和链接,容易形成信息孤岛。其核心原理在于通过预设的文件夹结构和智能路由,实现信息的自动归类与关联。这种自动化同步机制的技术价值在于彻底消除重复劳动和决策疲劳,让用户从繁琐的信息整理中解放出来,专注于高价值思考。在实际应用场景中,它尤其适合需要处理大量会议、任务和人际关系的知识工作者,如产品经理、项目经理和团队领

weixin_42521558的博客 379

大疆上云API-1.10.0版本-设备位置数据实时处理与WebSocket推送实战解析

本文深入解析了大疆上云API 1.10.0版本中设备位置数据的实时处理与推送全链路。通过剖析源码,详细阐述了从MQTT接收OSD数据、Spring Integration路由分发、业务逻辑处理到WebSocket实时推送至前端地图的核心流程,并提供了实战优化与避坑指南,帮助开发者构建高可靠的无人机实时定位系统。

weixin_29291863的博客 413

POJ 1163 The Triangle - 数字三角形详解

题意大致: 解题思路:这道题目可以用递归的方法解决。基本思路是:D(r,j)表示第 r 行第 j 个数字(r,j都从 1 开始算),以 MaxSum(r,j)代表从第 r 行的第 j 个数字到底边的最佳路径的数字之和,则本题目要求MaxSum(1,1)。 从某个D(i,j)出发,显然下一步只能走D(r+1,j)或 D(r+1,j+1)。如果走D(r+1,j),那么得到的Ma...

Patrick的博客 445

r3live 使用前提 雷达-相机外参标定 livox_camera_lidar_calibration

港科大livox_camera_calib虽然操作方便,但是使用mid360雷达会有视角问题(投影三维点到相机),尝试了很多场景,标定效果都不理想(推荐场景是楼梯间),看来港大的更适合avia之类窄角度的雷达。如果标定效果不好的话,就使用 getExt2节点,getExt1节点只优化外参,而getExt2节点在计算的时候会将一开始计算的内参作为初值和外参一起优化。一般使用getExt1节点即可,如果在外参初值验证过,并且异常值已经剔除后,优化还是有较大的残差,那么可以使用getExt2试一试。

z1872385的博客 2399

POJ-1163(The Triangle)动态规划基础题

7 3 8 8 1 0 2 7 4 4 4 5 2 6 5(Figure 1) Figure 1 shows a number triangle. Write a program that calculates the highest sum of numbers passed on a route that starts at the top an

henuzxy 1719

SAN存储与协议,了解SCSI、FC和ISCSI

在前面我们介绍SAN存储及iSCSI协议的时候了解到SAN存储其实是一个CS架构的系统。存储系统本身就是整个系统的服务端。以IP-SAN(也就是基于iSCSI的SAN存储)为例,其整体架构如图1所示。 图1 CS架构 对于存储系统来说,通常是由专业的存储厂商提供,比较知名的如EMC、NetAPP、IBM和日立等等。国内存储厂商也迅速崛起,比较知名的如华为、宏杉、浪潮和同友等等。另外,还有一些小的存储厂商,他们往往集中在某个领域,比如专注文件系统或者块存储等等。 除了专业的存储设备外,其实Linux

shuningzhang的专栏 2685

14、5G物理层的灵活解决方案:广义频分复用(GFDM)

广义频分复用(GFDM)作为一种高度灵活的5G物理层多载波调制方案,能够满足多样化应用场景的需求,包括高吞吐量的比特管道通信、低功耗高连接数的物联网、超低延迟的触觉互联网以及广覆盖的无线区域网。通过参数化配置,GFDM可适配LTE资源网格,实现与现有系统的兼容与共存。其支持多种解调方式、干扰消除技术、OQAM映射及预编码机制,兼具低带外发射、高频谱效率和强鲁棒性。GFDM还能统一描述OFDM、FBMC、FTN等多种经典与先进波形,成为5G及未来通信系统中极具潜力的通用波形框架。

gold8的专栏 108

POJ 1163 The Triangle DP

题目:题目链接 题目描述: 7 3 8 8 1 0 2 7 4 4 4 5 2 6 5 (Figure 1) Figure 1 shows a number triangle. Write a program that calculates the highest sum of numbers passed on a route that s...

wanglj的博客 360

网红商品数据抓取:基于Python的高效爬虫实战

本篇博客介绍了从爬取到存储、分析和可视化网红商品数据的完整流程。通过Python的强大生态,我们能够轻松完成复杂的数据抓取任务。在实际应用中,还可以将此爬虫与机器学习模型结合,进一步挖掘数据价值。

2201_76125261的博客 1476

The Triangle POJ - 1163

7 3 8 8 1 0 2 7 4 4 4 5 2 6 5 (Figure 1) Figure 1 shows a number triangle. Write a program that calculates the highest sum of numbers passed on a route that starts at the top an...

cjh1459463496的博客 197

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

poj1163The Triangle(简单DP)

poj1163The Triangle(简单DP)

1502

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

POJ 1163 The Triangle DP 逐点累加

题意:给定一个三角数组,从top(顶) 往下走走到base(脚)求一个路线,把这些路线的数字加起来和最大。可以走左下和右下。 思路:说是动态规划,但是我第一个想到的是逐点累加法,在triangle[i][j] 下一步只能是走triangle[i][j] 或者是triangle[i][j+1]。 那么我们可以逆向走,即从底部往上走,那么这样就很明显的知道在第k层的 i 点,选择下一步的...

216

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

POJ 1163 The Triangle

poj ACM dp 动态规划

上千主上-贝库塔 643

POJ 1163 The Triangle(dp)

Description 给出一个数字三角形,从三角形顶部数字走,每次只能走到这个数字的左下角或者右下角的数字,直到底部,计算走过的线路的数字之和,求这个和的最大值 Input 第一行为三角形的高度n(n Output 从三角形顶部走到底部走过的路线的最大数字和 Sample Input 5 7 3 8 8 1 0 2 7 4 4 4 5 2 6 5 Sample outp

ZSQ 538

poj-1163-The Triangle-动态规划dp

Akatsuki

Akatsuki 537

[DP] POJ - 1163 The Triangle

The Triangle Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 51206 Accepted: 31010 Description 7 3 8 8 1 0 2 7 4 4 4 5 2 6 5

希望变强大 271

poj1163The Triangle(动态规划)

The Triangle Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 41970   Accepted: 25383 Description 7 3 8 8 1 0 2 7 4 4 4 5 2 6 5 (Figure

bokzmm的博客 482

DP专题1 POJ 1163 The Triangle

传送门:http://poj.org/problem?id=1163                                                                                                                                                   The Triangle

转角撞到鬼ヾ 350

POJ1163 The Triangle

Description 7 3 8 8 1 0 2 7 4 4 4 5 2 6 5 (Figure 1) Figure 1 shows a number triangle. Write a program that calculates the highest sum of numbers passed on a route that

axiqia的专栏 444

Poj.1163.The Triangle

The TriangleTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 54244 Accepted: 32730Description7 3 8 8 1 0 2 7 4 4 4 5 2 6 5 (Figure 1)Figure 1 shows a number triangle. Wri...

红鲤鱼与绿鲤鱼与驴 316

The Triangle POJ 1163 题解

由题意得: 1.输入一个“n”,再输入n行数字,每行数字的个数与行数相等 2.由于是输出最大的和,由上往下找最大和,路线是越来越多;而由下往上找最大和,路线就是越来越少 3.代码如下: #include&lt;iostream&gt; #include&lt;algorithm&gt; using namespace std; #define maxn 101 int n,dp[ma...

aptx4869971的博客 240

POJ 1163 The Triangle【dp+杨辉三角加强版(递归)】

The Triangle Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 49955   Accepted: 30177 Description 73 88 1 02 7 4 44 5 2 6 5(Figure 1) Fig...

weixin_34026276的博客 193
上一篇: POJ 2559 Largest Rectangle in a Histogram (DP最大矩形面积)
下一篇: POJ 2533 Longest Ordered Subsequence (DP最长上升子序列)
王老大_
博客等级 码龄12年 11粉丝 83原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值