hdu 1069(记忆化搜索/LIS)

MoE混合专家架构原理与实战:揭秘大模型中那2%的激活奥秘 混合专家(MoE)是一种突破传统稠密模型瓶颈的关键稀疏化技术,其核心在于通过动态路由机制,在每次前向传播中仅激活少量专家子网络,从而在保持模型容量的同时大幅降低计算与显存开销。该架构将‘全参数参与’转变为‘按需激活’,本质是模型结构层面的条件计算范式升级。技术价值体现在推理效率跃升、硬件适配性增强及训练稳定性提升;典型应用场景包括千亿级大模型本地部署、低延迟API服务及多领域自适应推理。本文深入解析MoE的路由逻辑、专家隔离设计与负载均衡机制,并结合DeepSeek-R1与GPT-4等真实案例,揭示‘1.8 阅读详情

题意: 给你n种立方体的长宽高,每种都有无限个,立方体可以旋转。现在要摞立方体使得摞起来的高度尽可能高,要求上面的立方体的长和宽必须严格小于下面的立方体。

思路:每种立方体都有三种摆法,长宽高:(a, b, c)(a, c, b) (b, c, a)  输入的时候处理一下,存n*3个立方体。可以排一下序LIS来做,也可以记忆化搜索。

我写的记忆化搜索,但是一直WA,后来改成了LIS,可还是WA,看了半天也没看出有什么bug,于是去看了别人写的,发现跟我写的本质上没什么区别。。。。。。

最后发现不是我写错了,而是。。。用G++交可以过,之前一直用C++交就会WA,WTF,什么鬼。。。


记忆化搜索:

# include <iostream>
# include <algorithm>
# include <cstdio>
# include <cstring>
using namespace std;
typedef long long ll;
const int maxn = 100 + 5;
int dp[maxn];
int G[maxn][maxn];
int n;

struct Node {
    int a, b, c;
    void Set(int aa, int bb, int cc) {
        a = aa; b = bb; c = cc;
    }
} res[maxn];

int dfs(int);
void init();

int main(void)
{
    int Case = 0;
    while (scanf("%d", &n) && n) {
        init();
        int ans = 0;
        for (int i = 0; i < n; ++i) ans = max(ans, dfs(i));
        printf("Case %d: maximum height = %d\n", ++Case, ans);
    }

    return 0;
}

int dfs(int id) {
    int& d = dp[id];
    if (d != -1) return d;
    d = res[id].c;
    for (int i = 0; i < n; ++i) {
        if (G[id][i]) d = max(d, dfs(i) + res[id].c);
    }
    return d;
}

void init() {
    memset(dp, -1, sizeof dp);
    memset(G, 0, sizeof G);
    int t = 0; n *= 3;
    while (t < n) {
        scanf("%d %d %d", &res[t].a, &res[t].b, &res[t].c); ++t;
        res[t++].Set(res[t - 1].a, res[t - 1].c, res[t - 1].b);
        res[t++].Set(res[t - 1].b, res[t - 1].c, res[t - 1].a);
    }
    for (int i = 0; i < n; ++i) {
        if (res[i].a < res[i].b) swap(res[i].a, res[i].b);
    }
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            if (res[i].a < res[j].a && res[i].b < res[j].b)
                G[i][j] = 1;
        }
    }
}

LIS:

# include <iostream>
# include <algorithm>
# include <cstdio>
# include <cstring>
using namespace std;
typedef long long ll;
const int maxn = 100 + 5;
int dp[maxn];
int n;

struct Node {
    int a, b, c;
    bool operator < (const Node& n) const {
        if (a == n.a) return b > n.b;
        return a > n.a;
    }
    void Set(int aa, int bb, int cc) {
        a = aa; b = bb; c = cc;
    }
} res[maxn];

int main(void)
{
    int Case = 0;
    while (scanf("%d", &n) && n) {
        int t = 0; n *= 3;
        while (t < n) {
            scanf("%d %d %d", &res[t].a, &res[t].b, &res[t].c); ++t;
            res[t++].Set(res[t - 1].a, res[t - 1].c, res[t - 1].b);
            res[t++].Set(res[t - 1].b, res[t - 1].c, res[t - 1].a);
        }
        for (int i = 0; i < n; ++i) {
            if (res[i].a < res[i].b) swap(res[i].a, res[i].b);
        }
        sort(res, res + n);
        for (int i = 0; i < n; ++i) dp[i] = res[i].c;
        for (int i = 0; i < n; ++i) {
            for (int j = 0; j < i; ++j) {
                if (res[i].a < res[j].a && res[i].b < res[j].b)
                    dp[i] = max(dp[i], dp[j] + res[i].c);
            }
        }
        int ans = 0;
        for (int i = 0; i < n; ++i) ans = max(ans, dp[i]);

        printf("Case %d: maximum height = %d\n", ++Case, ans);
    }

    return 0;
}


R语言 百度坐标转换至WGS84坐标 本文利用R语言封装了百度坐标转换至WGS84坐标的函数,亲测有效,提供了便捷的百度坐标转换方法。 阅读详情

相关推荐

图论:Dijkstra算法——最详细的分析,图文并茂,一次看懂!

Dijstra算法

普罗米修斯的博客 18万+

HDU 最少拦截系统(LIS)

题目链接 知识点:字典树 思路:将单词存入字典树中,将经过每个节点单词的总数记录下来,查找时找到单词的最后一个字母的节点输出经过该节点单词总数即可 代码: #include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 2e6 + 5; int tree[maxn][30] = {0}, sum[maxn] = {0}, tot = 0; //tree存字典树,sum存该节点有几个单词经过,

Belief_7 214

从零开始:在Windows WSL中搭建Openfoam7+blastfoam2.0.0开发环境(避坑大全)

本文详细指导在Windows WSL中搭建OpenFOAM 7与BlastFOAM 2.0.0开发环境,重点解析了安装过程中的常见“坑点”,如编译模式不匹配导致的符号错误,并提供了从系统准备、软件部署到环境验证的完整解决方案,帮助开发者高效构建CFD与爆炸模拟开发平台。

stem5的博客 531

【HDU1069】 Monkey and Banana(动态规划)

这里是题目Monkey and Banana Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 15962 Accepted Submission(s): 8471Problem Description A group of re

烟火 402

OFDM基本原理

OFDM基础介绍,包括OFDM的核心思想,数学推导了OFDM信号的调制解调过程。

伊丽莎白的学习之路 8938

Win11用户文件夹中文名修改全攻略

本文详细介绍了Windows 11系统中修改中文用户文件夹名称的完整步骤。操作包含七个关键环节:前期数据备份、账户名称修改、管理员账户激活、用户文件夹重命名、注册表路径更新、收尾操作及注意事项。特别强调需要同步修改账户名、文件夹名和注册表关联路径,并建议操作前备份重要数据。文中还针对常见问题提供了解决方案,如软件报错时的符号链接创建方法。整个过程需谨慎操作,建议在管理员权限下逐步执行,修改完成后需验证系统及软件功能是否正常。

Qinti_mm的博客 3164

HDU-1069-经典DP

这个题题意就是选出一部分排列好的砖使得砖的高度最高。两个处理上的点:1.加入砖块时要加入输入的全排列,假设高度是3时,2.4.3这组加进去还要加进去4.2.3。例如:排完序后面一块砖是5.4.3,由于宽度相等,所以就不能选择了,实际上把这块2.4.3旋转一下变成4.2.3就能选择了。2.排序。排序要先排宽度再排长度,反之亦可,就是不能按照面积排(我一开始就按照面积排序怎么也不对QAQ)。然后就开始...

alusang的博客 1234

YOLO车辆测距、车辆识别与单目测距

YOLO(You Only Look Once)是一种实时物体检测系统,能够识别视频或图像中的多个对象,并确定其位置。结合车辆识别与单目测距技术,YOLO可以用于交通监控、自动驾驶等应用场景,通过单个摄像头实现车辆的识别与距离测量。YOLO结合单目测距技术,在多个应用领域展现出巨大的潜力与灵活性。其实时性和准确性为智能交通、自动驾驶等领域提供了强有力的技术支持。

走向CTO的路上... 1838

HDU——1069【Monkey and Banana】

【题意】: 有人要做实验,看看猴子的智商,在屋顶上边挂着吃的东西,然后给你一些木块的长、宽、高,问你猴子最高可以爬多高,下面的木块必须大于(不能等于)上面的木块。 【思考】: 感觉像贪心,但还要多一点dp的味道,如果你可以看出这是一个严格递增子序列的问题,那最好了,可惜我没看出来,所以用了dp,dp转移方程为:dp[i]=max( dp[i],dp[j]+hi[i]) ,所以开始码起来  ^...

sf_yang35的博客 217

提取边界线的思路与原理

本文提出一种多阶段点云边界提取方法,通过3D→2D→3D的维度转换实现高效处理。首先采用半径滤波去除离群点,将点云投影至二维平面后,运用两级Alpha-Shape算法(α=0.2/1.9)分别提取细节和平滑边界,结合欧式聚类筛选主轮廓。最后通过KD树匹配和体素滤波还原三维边界并去重。实验表明,该方法在保持亚毫米精度的同时,能有效处理建筑等结构化场景,参数设置合理:半径滤波(0.5m/20点)、聚类阈值0.6m、体素尺寸1mm。流程涵盖降噪→投影→边界优化→三维还原全链路,兼顾细节保留与抗噪能力。

weixin_45196569的博客 312

倾斜摄影数据转换为3DTile格式的方法:基于CesiumLab GIS

通过使用CesiumLab GIS,倾斜摄影数据可以方便地转换为3DTile格式,并在CesiumJS等3D地理信息可视化工具中进行展示和分析。一旦成功导入3DTile数据,就可以在CesiumLab GIS中利用其强大的可视化和分析功能进行进一步的处理。转换完成后,可以将生成的3DTile数据导入到CesiumLab GIS中进行可视化和分析。启动CesiumLab GIS应用程序,并按照界面上的指导导入转换后的3DTile数据。脚本将开始执行,并将倾斜摄影数据转换为3DTile格式。

ObDjango的博客 1083

HDU 1069(最长下降子序列)

题意:给n种类型的箱子,每种类型提供无限的数量。要求把这些箱子尽量叠高,上一层箱子的长宽必须都比下一层的箱子小,求可以叠的最高高度。   #include #include #include using namespace std; #define MAXN 120 #define MAX(a, b) ((a) > (b) ? (a) : (b)) #define M

ACM Dream 823

Alist/Openlist 的 WebDAV 老是连不上?别再乱试了,这才是标准答案!(1Panel如何使用Alist/Openlist作为备份账号)

😫服务器硬盘告急,想用 Alist/Openlist 的 WebDAV 备份却屡屡失败?别慌!本文带你揭秘正确的连接地址和权限配置,手把手教你搞定 1Panel 备份设置,让你的网盘秒变备份仓库!

XiaoqiangClub的博客 5646

专题整理——动态规划

知识点整理 基础DP(一)——硬币问题 基础DP(二)——0/1背包 基础DP(三)——最长公共子序列LCS 基础DP(四)——最长递增子序列LIS 递推与记忆化搜索 区间DP 树形DP 题目练习 题目 题解 类型 ...

lllllan 327

深度学习工具包 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")

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

HDU_1087

Super Jumping! Jumping! Jumping! Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 50536 Accepted Submission(s): 23436 Problem Description ...

larry1648637120的博客 193

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

从零单排5

前天晚上以及昨天下午和晚上报了三场hdu的西山居比赛。。。三场比赛一共A了三题。。。我果然是签到题小王子么。。。 今天上午搞了动态规划... 3. 动态规划(15题以上),要学会使用循环的方法写动态规划,同时也要学会使用记忆化搜索的方法。 a) 最大子串和 b) 最长公共子序列 c) 最长单调递增子序列(O(n)与O(n log n)算法都需要掌握) 数塔什么的最基本的就不

VeryBigMan 783

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

hdu-1069(dp)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1069 题意:一群猴子,给出n块砖的长x宽y高z,用这些砖拼起的高度最高是多少, 要求底下的砖的长宽都要大于上面那块。堆出高度最高的猴子最聪明。现在问最多能达到多高。 思路:从n块砖中找出x块砖并满足长宽要求使高度最高,可以用动态规划来做。 先按照砖的x,y升序排序,类似最长不下降子序列。 状...

weixin_30466039的博客 150

[动态规划]HDU - 1069 Monkey and Banana题解

一个方块可以叠在另一个方块上面,但他的需要他的长和宽小于下面的方块。再把所有的方块按长为第一关键字,宽为第二关键字从大到小排序。接着进行动态规划,把前面满足条件的最大值转移过来。有若干种方块,每一种方块有无限个,方块可以翻转。求可以用这若干种方块可以叠出来的最高高度。把方块长宽高全排列分为六个方块。最后所有的最大值就是答案。

[小吉祥物]白麟 462

hdu-1257 最少拦截系统(LIS)

最少拦截系统 Problem Description 某国为了防御敌国的导弹袭击,发展出一种导弹拦截系统.但是这种导弹拦截系统有一个缺陷:虽然它的第一发炮弹能够到达任意的高度,但是以后每一发炮弹都不能超过前一发的高度.某天,雷达捕捉到敌国的导弹来袭.由于该系统还在试用阶段,所以只有一套系统,因此有可能不能拦截所有的导弹. 怎么办呢?多搞几套系统呗!你说说倒蛮容易,成本呢?成本是个大问题啊.所以俺就到这里来求救了,请帮助计算一下最少需要多少套拦截系统. Input 输入若干组数据.每组数据包括:导弹总个数(正

weixin_47750287的博客 638

HDU 1069--DP--(摞箱子问题)

题意:有n中箱子,可以任意选择它的面作为底面,只有当底面的长和宽严格小于下面的箱子时才能放在下面的箱子上。求用这n种箱子能摞的最高的高度(每种箱子的个数不限)。 分析:dp 转移方程:dp[i]=max(dp[j]+a[i],dp[i]),j 从 0 到 i-1,在计算状态转移方程之前先判断箱子的长宽是否满足条件。预先要按照能摞的条件把箱子排序,然后dp;注意每种箱子有三种放置方式,相当于有三种

关于学习本身 1445

HDU1069(最长单调递减数列)

告诉你n种规模的长方体的长。宽,高,每种规模的长方体个数不限,问你最多能搭多高的塔,塔是由这些长方体搭的,自上而下,每一块长方体都要比在它以下的长方体的规模小,即长和宽都比以下的长方体要小。注意长方体是能够调整的。 就是依照长和宽来排序,找最长的单调递减的数列。我们用dp[i]来表示搭建到第i块长方体的时候塔的最高高度,那么状态转移方程就是dp[i]=max(dp[i],dp[...

adr5970的博客 239

HDU1025-二分求LIS。

1.题目链接。说了很多,但是一句话可以概括。在平行线的之间有一些线段,取一组线段使得任意两条不相交,求最多有多少条这样的线段。 2.分析:为什么就是转化成了LIS了呢?其实这个很简单,我们只需要考虑一条边,从1到n,然后把另一条边上的数字映射上来,并且是一一对应的,所以就是个数组了。a[i]=j;代表i和j之间有一条线段,做完这个映射之后,我们可以观察到,如果在poor cities中,i&lt...

YG爱木木 455

HDU 1069 (累积木)

大意:有n种积木,每种有无限多个,问面积大在下,小在上,最高能有多高。思路:给定无限种其实最多每种有三个积木可以用,然后进行面积的排序(面积或边长排序),进行DP(注意dp时条件为下边两边长一定大于上面两边长,一次不能按照面积排)。#include<map> #include<queue> #include<cmath> #include<iostream> #include<cstdio> #in

Grit_ICPC的博客 1034

HDU1069(最长上升子序列)

题目链接 这个题题意难一半。 表示看题看了好久。 题意:给定n种长方体,给定长方体长宽高,每个长方体有无限个,要堆成塔形,问最高能堆多高。下面的必须长宽均大于上面的。 题解:每个长方体怎么放是没有限制的,也就是说一个长方体可以有六种方法(刚开始我对这个存疑,但是亲手摆摆试试就知道了),也就是说我们最多将一个长方体可以扩展成六个,然后排个序,求最长上升子序列就可以了。 #include...

开心铁匠铺 278

hdu6197 最长上升子序列(LIS)长度

题意给你t组样例,每组样例给出n(<=1e5),k(<=n),再给你n个数组成的序列。问你能不能通过减去该序列中x(<=k)个数,使该序列变成一个非递增或非递减序列。可以输出A is a magic array.,不行就输出A is not a magic array.。题解这题可以转化成最长上升子序列的题。我们正着做一遍最长非递减序列(基本就是比最长上升子序列多个=)得出其长度len,如果len+

WilliamSun0122的博客 838

HDU 1069 Monkey and Banana

题目 Problem Description A group of researchers are designing an experiment to test the IQ of a monkey. They will hang a banana at the roof of a building, and at the mean time, provide the monkey with some blocks. If the monkey is clever enough, it shall be

wenrenfudi的博客 216
上一篇: uva127--手风琴纸牌
下一篇: HDU 1788-中国剩余定理
yaa123_
博客等级 码龄11年 5粉丝 28原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值
⌂ 换网址