light oj 1128

AMEsim柱塞泵的建模学习 提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档 文章目录前言一、为什么要对柱塞泵进行仿真?二、Amesim中柱塞泵的模型1.amesim中自己的定排量五柱塞的斜盘柱塞泵2.压力、流量仿真总结 前言 最近在学习Amesim进行柱塞泵的仿真学习,顺便在这里记录我的学习过程,这是我的初衷 提示:以下是本篇文章正文内容,下面案例可供参考 一、为什么要对柱塞泵进行仿真? 柱塞泵是功能和动力学比较复杂的流体机械。而在实际实验中,往往没有条件或者需要对柱塞泵做一些优化,所以需要我们利用仿真... 阅读详情

倍增法LCA + DP

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int N = 100010;
int val[N];
int p[N][18];

int main(){
	int t,T,n,q,i,j;
	int num,v;
	scanf("%d",&T);
	for(t=1;t<=T;t++){
        scanf("%d %d",&n,&q);
        memset(p,-1,sizeof(p));
        val[0]=1;
        for(i=1;i<n;i++){
            scanf("%d %d",&p[i][0],&val[i]);
            for(j=1;j<18;j++){
                p[i][j]=p[p[i][j-1]][j-1];
                if(p[i][j]==-1)break;
            }
        }
        printf("Case %d:\n",t);
        for(i=1;i<=q;i++){
            scanf("%d %d",&v,&num);
            for(j=17;j>=0;j--){
                if(p[v][j]!=-1 && val[p[v][j]]>=num)
                    v=p[v][j];
            }
            printf("%d\n",v);
        }
	}
	return 0;
}



23、管状剪纸结构的研究与功能生成连杆机构的综合设计 本文研究了管状剪纸结构的压缩运动特性,通过剪纸技术将非刚性可折叠的Yoshimura和Kresling折纸结构转化为刚性可折叠结构,并提出径向可闭合剪纸(RC-kiri)构型。推导了位移与折叠角之间的数学关系,设计了带外部LET接头的RC-kiri模型,建立了力-位移理论模型并通过Abaqus进行有限元验证,制作了3D打印物理模型以测量直径变化。同时,研究了四杆和六杆功能生成连杆机构的综合设计方法,基于负闭合运动链和最小二乘法实现函数生成。结果表明理论、仿真与实验整体吻合良好,误差来源得到分析,为机器人、机 阅读详情

相关推荐

从零开始:用Python搭建你的第一个加密货币量化交易机器人(附完整代码)

本文详细介绍了如何使用Python从零开始搭建一个加密货币量化交易机器人,涵盖环境准备、交易所API连接、基础交易策略实现、回测系统构建以及实盘部署等关键步骤。通过完整的代码示例,帮助读者快速掌握数字货币量化交易的核心技术,适合有一定编程基础的投资者入门。

weixin_30415113的博客 474

LightOJ - 1128 (倍增法 + dp)

唔 已经有一个多月没有写题解了, 其实这一个多月也是做了一些题目的,但是就是比较懒啊,所以都堆在一起没有写了~~。 题目链接: http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=26842 题意: 给出一棵树(有默认根), 每个节点有一个权值,再给出q个询问,每个询问包含v k两个变量, 让你输出树根和v节点

乐观之奋斗者 859

Python入门之机器学习(非常详细)篇幅拉满,一般人看不完!

什么是机器学习?监督学习 supervised learning;非监督学习 unsupervised learning;半监督学习 semi-supervised learning;强化学习 reinforcement learning;监督学习是不断向计算机提供数据(特征),并告诉计算机对应的值(标签),最后通过大量的数据,让计算机自己学会判断和识别。例如Google Photo,你在APP中输入狗,这时就会弹出与狗相关的图片,这背后使用的算法就是监督学习。

xiaolinyui的博客 2万+

lightoj-1128-Greatest Parent(二分+LCA)

传送门 首先我要实力吐槽这个lightoj 它给我的注册密码藏在不为人所见的地方 注册注册了10多分钟 qwq ---------------------------------------------------------------- 其次我要再吐槽一下这个难懂的题目 全英文emm... 百度翻译都救不了我 (我画图花半天,才懂emm...) ...

weixin_30599769的博客 156

手把手用瑞萨E1仿真器调试RH850 CAN通信:从报文收发到底层寄存器监控

本文详细介绍了使用瑞萨E1仿真器调试RH850 CAN通信的全过程,包括硬件连接、CS+开发环境配置、CAN控制器寄存器解析以及双通道网关实战开发。通过实战案例和错误诊断技巧,帮助开发者快速掌握RH850F1L的RS-CAN控制器应用,提升车载网络开发效率。

weixin_30919429的博客 171

【matlab】使用alexnet进行特征提取

1.下载alexnet工具箱 在命令栏输入alexnet,若不报错说明已经安装,若出现错误按照提示去下载工具箱; 下载地址:https://ww2.mathworks.cn/matlabcentral/fileexchange/59133-deep-learning-toolbox-model-for-alexnet-network (1)需要先注册(十分简单),登陆,下载; (2)下载完成之后,...

jingjingliang1995的博客 5863

LightOJ 1128 Greatest Parent

给一个 n 个点的多叉小顶堆,每个节点都有个编号(0 ~ n-1)和值,0 号点为根且值为 1。儿子结点编号、值都严格大于父结点。每次询问都给出一个结点编号 k 和值 v,求在 k 的祖先结点(包括自己)中值大于等于 k 的编号尽量大的点的编号。

iTom's blog 494

深度解读扫地机器人的导航原理

科技改变生活,不可否认科技的进步的确为我们的生活带来许多便捷,以智能家电为例,智能电饭煲、智能洗碗机、智能扫地机等产品已逐渐成为家庭的一分子,其中以扫地机表现最为抢眼。能做到智能规划清扫,收割了不少家庭主妇及科技爱好者的芳心。但扫地机并非一开始就这么智能,最初的扫地机只能做到随机式清扫,会频繁出现碰撞现象。 近年来,通过业界的不断努力,目前,扫地机器人已告别乱碰乱撞现象,能做到自主路径...

qq_38403231的博客 6514

LightOJ 1128 Greatest Parent

题面题意 给出一棵树,每个点都有一个权,每次查询一个点的祖先中比某个数大的最大深度. 已知父节点的权绝对严格小于其子节点 方法 建树之后,利用倍增进行与二分类似的思想进行查找,fa[i][j]记录点i向上(1 << j)代的父亲. 每次查找都找不超过当前范围的最大祖宗. 代码#include<bits/stdc++.h> #define N 500100 using namesp

yzyyylx的博客 329

clock min pulse width检查

高电平脉宽 = clock fall edge到达FF/CK的时间 - clock rise edge到达FF/CK的时间;低电平脉宽 = 下一T clock rise edge到达FF/CK的时间 - clock fall edge到达FF/CK的时间。而required pulse width是根据FF/CK处的transition,根据查找表计算得到的。为什么clock transition越大,会导致required pulse width越大呢?5、 降低clock上的串扰。

芯冰乐 590

RK3588S之CPU--benchmark(一)

本章会基于RK3588S来介绍有关CPU常用的benchmark工具及测试过程

文艺小少年的博客 1503

Greatest Parents Ligh OJ1128

其实倍增可以”缩”题意:一棵树的点权会给你,每一次询问一个x,y 问在x的祖先之中(包括x) 权值 >=y的而且是离x最远的点的编号!思路核心的什么也不说了,只是希望说一说这个: 每一次倍增,dp[i][j]~dp[i][0]其实就是相当于是一个二分搜索的过程呢! 比如dp[i][3]会符合答案,那么i就会自动”跳”到 i+2^3的地方,继续在(i+2^3)的地方2^2 一直下去,于是就有了答

Bartholomew_的博客 303

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

Light OJ 1128 - Greatest Parent

题意:  求最近公共祖先

Step by step 854

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

light oj 1128 倍增法LCA + DP

题意:一棵树,每个点都有一个点权,给你q个询问a b,求a到根节点的路径中点权大于等于b且最接近根节点的点编号 刚开始想用树链剖分搞,后来听说用倍增+DP也行 做法: 如果懂倍增法求祖先的方法的话,那么这个DP就能很快理解了,详情见代码 dp[i][j]表示i到i的2^j祖先的路径上的点权的最大值 那么在找的时候只需要log(n)的复杂度就可以找到最上面的点权大于等于b的啦 #

努力奋斗才能梦想成真 2009

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

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

倍增求LCA的模板

/* 2^17=131072; 2^18=262144; */ const int POW = 18; void dfs(int u,int fa){ d[u]=d[fa]+1; p[u][0]=fa; for(int i=1;i<POW;i++) p[u][i]=p[p[u][i-1]][i-1]; int sz=edge[u].size(); for(int i=0;i<sz;

1292765944的专栏 4601

Codeforces 124 E

最小生成树的好题! 需要构造只包含k个点的图,但是如果暴力去搞必然超时,所以只加入有可能成为MST中的边的边,最后求一遍最小生成树 First of all, we can note that if each graph vertex is portal, the answer will be a sum of all edges' weights in MST (minimal span

1292765944的专栏 3422

POJ 1041 John's trip欧拉路

很简单的一道求欧拉路的题。用矩阵的话最好用关联矩阵,因为可能两点间连好几条路,用vector存的话记着要sort #include #include #include #include using namespace std; int map[46][2000],d[46],m; bool vis[2000]; stackst; int max(int a,int b){ return a>

1292765944的专栏 2591

HDU 4757

可持久化trie树。不会可持久化数据结构的话推荐先看陈立杰的论文。先掌握可持久化线段树和可持久化trie树。

1292765944的专栏 2397

2011年北京区域赛A题

次小生成树的简单应用 #include #include #include #include #include #define N 1010 using namespace std; int x[N],y[N],p[N],vis[N]; double dis[N][N],d[N],mx[N][N]; int main(){ int t,T,i,j,n; double A,B,

1292765944的专栏 2204

[SCOI2005]王室联邦

Description “余”人国的国王想重新编制他的国家。他想把他的国家划分成若干个省,每个省都由他们王室联邦的一个成员来管理。他的国家有n个城市,编号为1..n。一些城市之间有道路相连,任意两个不同的城市之间有且仅有一条直接或间接的道路。为了防止管理太过分散,每个省至少要有B个城市,为了能有效的管理,每个省最多只有3B个城市。每个省必须有一个省会,这个省会可以位于省内,也可以在该省外。但

1292765944的专栏 1895

POJ 3728 The merchant

这个题算是LCA的一个高级应用吧。 其实就是在维护u,v到其最近公共祖先的几个数据(将u,v分成两段,一个从u到LCA(u,v),一个从LCA(u,v)到v,分别维护即可) #include #include #include #define con 50100 using namespace std; int head1[con],head2[con],head3[con],p,n,num[

1292765944的专栏 1892

HDU 4756 && HDU 4126

两个题次小生成树的扩展题。 先prim求出最小生成树,枚举删除每条树边后求分割成的两部分之间的最小连接费用,这一步用一个O(n^2)的n遍dfs求解。 不过HDU 4756这个题我被sqrt函数卡死,之前的写法HDU被卡爆栈,給sqrt传负数爆栈 //double tmp=(double)(x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]); dis[i][j]=dis[j][i]=sqrt(tmp);

1292765944的专栏 1879

hdu 4115

简单2-sat 方法一:找到矛盾项(选x不能选y) 若c == 0{   //第u次与第v次相同             if(a[u] != a[v]) g[u].push_back(v+n),g[v].push_back(u+n);             if(a[u] != b[v]) g[u].push_back(v),g[v+n].push_back(u+n);

1292765944的专栏 1808

HDU 4421

2012长春现场赛的题 正解要枚举32个bit,每次做2sat判断是否矛盾 #include #include #include #define N 510 #define NN 1010 #define M 3000100 using namespace std; int n,b[N][N]; int head[NN],cnt,scc,top,Index; int dfn[NN],l

1292765944的专栏 1587

HDU 3681 Prison Break 哈密顿回路DP

题意是已知一幅矩阵迷宫,給起点,开始时充满电,要求是遍历给定的点,每移动一次花费1,迷宫中有若干充电池可充满电(每个充电池只能用一次),求原始电量最少是多少*/ 首先抽象出起点、终点、充电池,建立他们的最短路径图,二分枚举原始电量 从而转化为 哈密尔顿回路的状态DP问题 。这样建图原理是:对于原图当前用不用充电池 在新图中 我们可以用两种不同的边来表示(在新图中通过一条边移动到一个充电池则一

1292765944的专栏 1543

POJ 1985 && BOJ 196 && HDU 2196

树型DP维护从有根树的顶点出发到叶子的最长距离和次长距离(要保证通过不同的孩子) POJ 1985 #include #include #include #include using namespace std; int head[40010],cnt; int dp1[40010],dp2[40010]; int ans=0; struct Edge{ int v,c,next; }

1292765944的专栏 1506
上一篇: 倍增求LCA的模板
下一篇: ZOJ 3649
Benzema67
博客等级 码龄15年 120粉丝 357原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值
⌂ 换网址