TC SRM 557 DIV2 1000

经典状态dp题目 POJ 1185 炮兵阵地 一般这类题目列会很小10左右,我们需要枚举所有行,对于当前行,其放炮的位置只与上一行和上上行有关,我们记当前行状态和上一行状态便可转移了,dp数组开3维即可。 在枚举每一行放炮兵的方法时,可以预处理方便获得所有可能放法。具体细节见代码。总体复杂度O(Row*70*70*70),70是预处理得到的每一行最多放法。打表很容易看出来。 #include #inclu 阅读详情

比较好的dp

当k=m时,dp[i][j][m]记录走i位字符串上目前和为j且目标串是目前字符串的字串的个数为k

当k!=m时,dp[i][j][k]记录走i位字符串上目前和为j且后缀和目标串匹配的个数为k的个数

而e[i][0]表示目标串的前i位+‘U’  后缀匹配目标串的最大长度

e[i][1]同理类似。

// BEGIN CUT HERE

// END CUT HERE
#line 5 "FoxAndMountain.cpp"
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
using namespace std;

typedef long long ll;
int e[200][2];
ll dp[110][110][110];
int match(string a,string b){
    while(a.substr(0,b.length())!=b)
        b=b.substr(1);
    return b.length();
}
class FoxAndMountain
{
        public:
        int count(int n, string history)
        {
                int i,j,k;
                int m=history.size();
                for(i=0;i<m;i++){
                    e[i][0]=match(history,history.substr(0,i)+'U');
                    e[i][1]=match(history,history.substr(0,i)+'D');
                }
                e[m][0]=e[m][1]=m;
                memset(dp,0,sizeof(dp));
                dp[0][0][0]=1;
                for(i=0;i<n;i++)
                    for(j=0;j<=i;j++){
                        for(k=0;k<=m && k<=i;k++){
                            dp[i+1][j+1][e[k][0]]+=dp[i][j][k];
                            if(j)dp[i+1][j-1][e[k][1]]+=dp[i][j][k];
                        }
                    }
                return (int)(dp[n][0][m]%1000000009);
        }

// BEGIN CUT HERE
	public:
	void run_test(int Case) { if ((Case == -1) || (Case == 0)) test_case_0(); if ((Case == -1) || (Case == 1)) test_case_1(); if ((Case == -1) || (Case == 2)) test_case_2(); if ((Case == -1) || (Case == 3)) test_case_3(); if ((Case == -1) || (Case == 4)) test_case_4(); if ((Case == -1) || (Case == 5)) test_case_5(); if ((Case == -1) || (Case == 6)) test_case_6(); }
	private:
	template <typename T> string print_array(const vector<T> &V) { ostringstream os; os << "{ "; for (typename vector<T>::const_iterator iter = V.begin(); iter != V.end(); ++iter) os << '\"' << *iter << "\","; os << " }"; return os.str(); }
	void verify_case(int Case, const int &Expected, const int &Received) { cerr << "Test Case #" << Case << "..."; if (Expected == Received) cerr << "PASSED" << endl; else { cerr << "FAILED" << endl; cerr << "\tExpected: \"" << Expected << '\"' << endl; cerr << "\tReceived: \"" << Received << '\"' << endl; } }
	void test_case_0() { int Arg0 = 4; string Arg1 = "UUDD"; int Arg2 = 1; verify_case(0, Arg2, count(Arg0, Arg1)); }
	void test_case_1() { int Arg0 = 4; string Arg1 = "DUUD"; int Arg2 = 0; verify_case(1, Arg2, count(Arg0, Arg1)); }
	void test_case_2() { int Arg0 = 4; string Arg1 = "UU"; int Arg2 = 1; verify_case(2, Arg2, count(Arg0, Arg1)); }
	void test_case_3() { int Arg0 = 49; string Arg1 = "U"; int Arg2 = 0; verify_case(3, Arg2, count(Arg0, Arg1)); }
	void test_case_4() { int Arg0 = 20; string Arg1 = "UUUDUUU"; int Arg2 = 990; verify_case(4, Arg2, count(Arg0, Arg1)); }
	void test_case_5() { int Arg0 = 30; string Arg1 = "DUDUDUDUDUDUDUDU"; int Arg2 = 3718; verify_case(5, Arg2, count(Arg0, Arg1)); }
	void test_case_6() { int Arg0 = 50; string Arg1 = "U"; int Arg2 = 946357703; verify_case(6, Arg2, count(Arg0, Arg1)); }

// END CUT HERE

};

// BEGIN CUT HERE
int main()
{
        FoxAndMountain ___test;
        ___test.run_test(-1);
        return 0;
}
// END CUT HERE


春秋BC742年世界历史地图矢量文件SHP格式.zip 本资源为《春秋BC742年世界历史地图矢量文件SHP格式》压缩包,文件大小约 26.55 MB,便于集中下载、整理和使用。具体内容请结合压缩包内的实际文件与说明查看。 在当前可读取的目录中,可见属性表(.dbf)、投影说明文件(.prj)、Shapefile 主文件(.shp)、Shapefile 索引(.shx)。建议解压后保持原有目录结构,先浏览文件清单与说明,再选择需要的资料进行加载或整理。 应用方面,可根据实际资料用于学习练习、资料检索、研究整理或项目参考。使用时可先确定所需内容,建立清晰的文件分类,再按项目要求进行筛选、转换与汇总。 使用 Shapefile 数据时,请把实际配套的 .shp、.shx、.dbf 等文件保存在同一目录,并保持同名关联;加载后再检查坐标系与中文字段显示。如需叠加其它数据,请先统一坐标与字段口径。 数据来源、时间范围、坐标系、字段定义、精度和使用条件,请以实际文件及原始说明为准。本介绍不对文件名之外尚未核实的信息作额外承诺。 立即下载

相关推荐

春秋BC674年世界历史地图矢量文件SHP格式.zip

本资源为《春秋BC674年世界历史地图矢量文件SHP格式》压缩包,文件大小约 26.49 MB,便于集中下载、整理和使用。具体内容请结合压缩包内的实际文件与说明查看。 在当前可读取的目录中,可见属性表(.dbf)、投影说明文件(.prj)、Shapefile 主文件(.shp)、Shapefile 索引(.shx)。建议解压后保持原有目录结构,先浏览文件清单与说明,再选择需要的资料进行加载或整理。 应用方面,可根据实际资料用于学习练习、资料检索、研究整理或项目参考。使用时可先确定所需内容,建立清晰的文件分类,再按项目要求进行筛选、转换与汇总。 使用 Shapefile 数据时,请把实际配套的 .shp、.shx、.dbf 等文件保存在同一目录,并保持同名关联;加载后再检查坐标系与中文字段显示。如需叠加其它数据,请先统一坐标与字段口径。 数据来源、时间范围、坐标系、字段定义、精度和使用条件,请以实际文件及原始说明为准。本介绍不对文件名之外尚未核实的信息作额外承诺。

SRM 557 小记

250pt: 水题 500pt:状态压缩枚举,系统测试挂了,囧。。。 1000pt:可以这样抽象题意,构造长度为len的且包含模式串的总权值为0的串,求这样的串的个数,字符串由‘U’和‘D’组成,‘U’:+1     ‘D’:-1. DP,套了个AC自动机,大材小用了- - 状态很简单的,转移的时候要注意转移到的状态是否已经包含模式串 #include #include #include

努力奋斗才能梦想成真 1316

欠驱动水面船舶的自适应神经(NN)控制圆形+直线轨迹跟踪控制研究(Matlab代码实现)

内容概要:本文针对欠驱动水面船舶在圆形和直线轨迹下的高精度跟踪控制问题,提出了一种基于自适应神经网络(Adaptive Neural Network, NN)的非线性控制方法。该方法有效应对船舶在欠驱动条件下存在的强耦合、非线性动力学特性以及外界环境干扰(如风浪流)等挑战。通过构建适当的神经网络逼近系统未知非线性项,并结合Lyapunov稳定性理论设计自适应律,确保闭环系统的全局一致最终有界性(UUB)。文中详细阐述了控制器结构设计、神经网络权重在线更新机制、控制律推导过程,并利用Matlab/Simulink平台对直线与圆形期望轨迹进行了仿真验证,结果表明所提方法具有良好的跟踪精度、动态响应性能与抗干扰能力,适用于复杂海洋环境下无人船的自主航行控制任务。; 适合人群:具备自动控制理论、船舶与海洋工程或机器人控制等相关专业背景,熟悉非线性系统分析、自适应控制原理,并掌握Matlab仿真工具的研究生、科研人员及从事无人船控制系统开发的工程技术人员。; 使用场景及目标:①研究欠驱动船舶在复杂轨迹下的自主跟踪控制策略;②掌握自适应神经网络在不确定非线性系统中的建模与补偿方法;③复现并拓展高水平期刊论文中的智能控制算法;④为无人水面艇(USV)的实际控制系统开发提供理论支持与仿真验证基础。; 阅读建议:建议读者结合文中的数学推导与Matlab代码实现同步学习,重点理解Lyapunov函数的构造思路、神经网络逼近机制及其参数自适应调整规律,有条件者可进一步将算法迁移至硬件在环(HIL)平台或实船系统进行测试,并与其他先进控制方法(如滑模控制、模型预测控制)开展性能对比分析。

[线性基 贪心] Topcoder SRM557Div1. XorAndSum

对数列建线性基,求出最大异或值 那么不在线性基里面的元素可以把它变成最大异或值 在线性基里的元素,可以把最高位的元素变成最大值,然后把其他数异或上最大值 #include &lt;cstdio&gt; #include &lt;iostream&gt; #include &lt;algorithm&gt; #include &lt;cstring&gt; #include &lt;vec...

CE玩家 768

ubuntu20.04下dsp-slam的运行配置

DSP-SLAM:具有深度形状先验的面向对象的 SLAM

baidu_38431960的博客 3170

CS5523实战:如何用国产芯片完美替代LT8911设计MIPI转eDP电路(附原理图)

本文详细介绍了使用国产芯片CS5523完美替代LT8911进行MIPI转eDP电路设计的实战经验。文章从芯片选型、核心特性对比入手,深入剖析了电源时钟设计、MIPI/eDP接口的PCB布局与信号完整性要点,并提供了完整的原理图参考和调试排错指南,为硬件工程师实现国产化替代提供了清晰可行的方案。

yhn4567890的博客 1145

最长单调递增子序列 poj 2544 || HDU 3998

单调子序列包含有单调递增子序列和递减子序列,不失一般性,这里只讨论单调递增子序列。首先,从定义上明确我们的问题。给定序列a1, a2, …, an,如果存在满足下列条件的子序列 ai1i2im, (其中i1 即称为一个原序列的长度为m的单调递增子序列,那么,现在的问题是我们要找出一个序列的最长的单调递增子序列。 直观上来说,一个序列Sn,它有2n个子序列,枚举所有的子序列,找出其中单调递

1292765944的专栏 2435

实战测评:4大搜索API(You.com/Tavily/Exa/Perplexity)谁更适合你的AI项目?附Python调用代码

本文实战测评了You.com、Tavily、Exa和Perplexity四大搜索API在AI项目中的集成应用,详细对比了它们的技术特性和Python调用方法。针对LLM实时数据需求,You.com的优化设计表现突出,支持32k大上下文窗口和快速响应。文章提供了完整的代码示例和场景化选型建议,帮助开发者高效集成搜索API到AI项目中。

weixin_42569329的博客 492

HDU 4734

比赛的时候先写了个裸的数位dp T掉了,然后加加剪枝过了

1292765944的专栏 2385

OpenAI最强编程助手Codex:下载安装、使用指南(含使用方式、提示技巧、趋势)

OpenAI最近上线了最强编程Agent——Codex,一起来看看吧!

Code_流苏:在代码中寻诗意,在实践中觅真知 1万+

【SAP HANA 24】HANA与Oracle SQL语法对照表

HANA SQL参考及Oracle 语法对照

探索 Java 编程的技巧、最佳实践和解决方案。本博客提供针对 Java 开发者的实用指南,涵盖从基础到高级话题,旨在提升编程效率和技能。 1432

POJ 3666 Making the Grade

这个题要往DP上想(左偏树什么的也不会) 首先要知道这样一个结论:一定存在一个最优解,使得整理后的数组中不存在整理前数组中不存在的数,亦即:对于每个Bi,一定存在j,使得Bi=Aj。 可以这么想,在做调整时,一定是这么做的,先选出连续的三个数abc, 假设a            如果b>=a && b            如果b            如果b>c,则最小的调整可以是

1292765944的专栏 2153

Jetson Orin Nano 平台适配IMX585 camera驱动调试记录

Jetson Orin Nano Devkit适配imx585 camera使用argus_camera捕获流,图片是黑色的用示波器来测量mipi信号,信号正常Jetpack版本: sensor参数: dts配置: 分析log: 如图: EBD有两行修改dts: 测试如下:log: 需要注意极性互换查看相应的原理图设置。可以使用设备树属性lane_polarity在任何lane上配置极性交换。例如, 尝试调整极性出现花屏 根据上述像素时钟配置说明调整为如下配置后,出图正常

jzwjzw19900922的博客 1326

HDU 2476

卡了我三天的DP 看了这篇博客才略微懂点http://blog.csdn.net/hyogahyoga/article/details/7886416 #include #include #include using namespace std; string a,b; int dp[200][200]; int f[200]; void solve(int i,int j) { if

1292765944的专栏 2139

时空智友企业流程化管控系统文件上传漏洞

时空智友企业流程化管控系统是一个功能丰富、灵活可定制的企业管理工具。通过该系统,企业能够实现流程的自动化、协同的提升、数据的洞察和决策的优化,从而提高工作效率、管理水平和企业竞争力。时空智友企业流程化管控系统 formservice接口处存在任意文件上传漏洞,未经认证的攻击者可通过此接口上传后门文件,最终可导致服务器失陷。

holyxp的博客 1039

数据治理——详解元数据、资源目录、主数据、数据元、元数据管理、主数据管理【附全文阅读】

摘要:数据中心建设的核心是元数据管理,即"描述数据的数据",包含内容、质量、所有者等关键信息。元数据在数据仓库中记录数据源、转换规则等,是管理基础;主数据管理则确保核心业务数据的准确一致。二者共同构建高效的数据资源目录,为数据服务提供支撑。(99字)

cdfunlove的博客 114

UVALive 6190

这道题卡了我们整场,我们想到了二分答案+判断可行性,但是卡在判断可行性上了,首先n^2的复杂度是肯定不行的,正解要优化到O(n) dp[i]表示以第i个单词作为一行结尾是否可行,初始化dp[0]=1,然后是一个迭代的过程,由dp[i]推出一个区间可行解dp[left~right]=1;接下来从left+1推出下一个区间可行解,最后在加点判断即可。注意要在整个过程中维护一个变量k表示当前最大的满足

1292765944的专栏 1935

WINCC7.3破解文件

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

HDU 4049

好题mark 1. 图论方法(最大权闭合子图) #include #include #define min(a,b) ((a)<(b)?(a):(b)) const int N=1110; const int E=5000; const int oo=1000000000; int node,src,dest,ne; int head[N],work[N],Q[N],dist[N]

1292765944的专栏 1510

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

InTheHand.Net.Personal+BlueTooth4,蓝牙开发

项目中有蓝牙开发的必备dll,现在网上相关的文档博客不少,有的说的多有的说少,但是却很少有这两个dll,分享一下。

hdu 4055

不错的dp long long 果然比int慢好多 #include #include #include #include #include #define N 1010 #define mod 1000000007 using namespace std; typedef long long ll; int sum[N][N]; char s[1010]; int main(){

1292765944的专栏 1485

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

zoj 2338

HanioTower的加强版 记f[n][m]为n个disc,m个peg的Hanoi问题,则有dp公式f[n][m]=min{f[n-k][m-1]+2*f[k][m]}。即把上面的k个disc利用m个peg转移某个中间peg,再把下面的n-k个disc利用m-1个peg转移到目标peg,最后把上面的k个disc利用m个peg移到目标peg。dp过程记下使得f[n][m]最小的g[n][m]

1292765944的专栏 1480

POJ 3345 Bribing FIPA 树形DP

这个题就是一个树形DP,输入处理有点恶心,RE好几次。其他要注意的地方我都标注释了 #include #include #include #define inf 1e9 typedef long long ll; int n,m,k,cou; char map[205][105]; int mon[205],head[205]; int dps[205][205]; struct poin

1292765944的专栏 1469

HDU 1428 漫步校园

我队列开小了,改成循环队列就过了,真坑爹.... 先SPFA求出各点到终点的最短距离,然后在记忆化搜一遍,记录路径数目,注意在搜的过程中,如果移动点的dis大于等于当前位置,那么就是不可以走的,反之就是可以走的。 #include #include #define inf 1e9 using namespace std; int n,t[52][52],dis[52][52]; __int

1292765944的专栏 1460

POJ 3638 Moogle

dp[i][j]表示在i位置放第j个的最小error,简单DP即可 #include #include #include #define inf 1e9; int h,in[210]; double e[210][210]; double dp[210][210]; double min(double a,double b){ return a>b?b:a; } int main(){

1292765944的专栏 1384

POJ 2228 Naptime

这个考的是环形DP,状态方程好列,需要注意的是要分两种情况讨论:一是第一段时间睡觉,另外是第一段时间不睡。剩下的DP过程一样,在最后处理结果上不同 #include #include #include typedef long long ll; int n,b,a[3900]; ll dp[2][3900][2]; ll max(ll a,ll b){ return a>b?a:b; }

1292765944的专栏 1363

zoj 3397

这是一道Hanio Tower的变形题 要按绩点从低到高处理: 如果他已在目标位置,那么不动; 如果他要从计算机(数学)到中文,或者从中文到计算机(数学),那么首先把绩点更高的人移到数学(计算机),这部分递归做,然后实现转系; 如果他要从计算机(数学)到数学(计算机),那么就相当于先做从计算机(数学)到中文,再做从中文到数学(计算机); #include #include

1292765944的专栏 1333

zoj 3494

数位dp+ac自动机 #include #include #include #include #define mod 1000000009 #define N 2010 typedef long long ll; using namespace std; char s[210]; int next[N][2],nextd[N][10],pos,flag[N],fail[N]; ll dp

1292765944的专栏 1320
上一篇: POJ 2949
下一篇: CF 208E
Benzema67
博客等级 码龄15年 120粉丝 357原创
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值