Codeforces 265 Escape from Stones 思维(极限)

Halcon 3D视觉实战:5步将线激光高度数据转为可分析的深度图与点云 本文详细介绍了如何利用Halcon平台将线激光高度数据转换为深度图与点云的5步实战方法。通过具体代码示例和工业检测案例(如锂电池胶水测量),帮助工程师高效处理3D视觉数据,实现从原始数据到三维可视化的完整技术链路。 阅读详情

点击打开链接

题意:n块stone 初始l=0,r=1 stone总是落在k=(l+r)/2,如果s[i]=='l' 则端点变为:[l,k]否则端点为[k,r],问从左到右stone的编号
n<=1e6 直接模拟每次/2会爆精度. 

每次把线段分成两段A,B 每次进入其中一段后,在也不会进入另外一段 
容易发现:如果s[i]=='l' 则stone i的位置比stone i+1~n 都大
如果 s[i]=='r'  则stone i的位置比stone i+1~n 都小
记录p[i] 比stone i小的个数 == cnt[r](1~i-1 r的个数)+s[i]=='l'? n-i:0;  

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e6+20;
char s[N];
pair<int,int> p[N];//p[i] 比第i块stone的小的个数 ,编号 
int main()
{
	while(scanf("%s",s)!=EOF)
	{
		int n=strlen(s);
		int cnt=0; 
		for(int i=0;s[i];i++)
		{
			p[i].first=cnt;
			p[i].second=i+1;
			if(s[i]=='l')
			p[i].first+=n-i;
			else
			cnt++;
			
		}	
		sort(p,p+n);
		for(int i=0;i<n;i++)
			printf("%d ",p[i].second);
	}
	
	return 0;
}


ROS与Qt5人机交互界面开发:添加rviz显示界面 最后,点击"完成"以创建新的Qt5应用程序项目。通过结合ROS和Qt5,您可以创建强大的人机交互界面,以实现丰富的机器人控制和数据可视化。在本教程中,我们将在主窗口中创建一个简单的按钮,用于启动rviz显示界面。在Qt Creator的槽函数编辑器中,为按钮添加一个槽函数,该函数将在单击按钮时调用。在上面的代码中,我们使用QProcess类启动了一个新的进程,并执行"rviz"命令来启动rviz显示界面。当您单击Qt5应用程序中的按钮时,将会启动一个新的rviz窗口,显示机器人数据的可视化界面。 阅读详情

相关推荐

IEEE Transactions on Industrial Informatics(TII)投稿全流程解析:从准备到成功提交

本文详细解析了向IEEE Transactions on Industrial Informatics(TII)投稿的全流程,涵盖从投稿前的格式准备、内容结构优化到在线提交系统实操等关键环节。重点强调了遵守TII严格的格式规范、双盲评审要求以及如何构建有说服力的学术叙述,旨在帮助研究者提升稿件质量,顺利通过评审。

weixin_28396629的博客 1892

CodeForces - 1538A Stone Game【博弈】

A. Stone Game time limit per test2 seconds memory limit per test256 megabytes Polycarp is playing a new computer game. This game has n stones in a row. The stone on the position i has integer power ai. The powers of all stones are distinct. Each turn Polyc

海岛Blog 606

【论文精度】生成式预训练模型——BART(Bidirectional and Auto-Regressive Transformers)

​ BART是一个预训练的seq2seq的去噪自编码(denoising autoencoder)模型,BART以下方式进行训练①用任意的噪声函数(noising function)去破坏文本;②学习一个模型来重建原始文本。它使用一个标准的基于transformer的神经机器翻译架构,可以看作是BERT(双向编码器)、GPT(left-to-right解码器)以及其他预训练方案的推广。

weixin_45828972的博客 7461

Codeforces 226B Naughty Stone Piles 贪心

题意:有n(1          不过没有那么简单,现在有m(1)个询问ki(1),问每堆石子至多被合并ki次,求把所有石子合并在一起的最小花费。 题解:看到数据量显然贪心+乱搞。          首先想ki = 1的情形,不难想到,一堆石子被合并一次,一堆石子被合并一次…一堆石子被合并一次,这显然是让最少的石子去合并别的石子n-1次。          考虑ki = 2,一堆石子被合并

Uhh, call me zacky NOW!!! 1325

<202505高项>《【VIP合集】 软考高项(第四版)十大知识域、五大过程组、ITTO输入输出工具、项目绩效域》

软考高项(第四版)十大知识域、五大过程组、ITTO输入输出工具、项目绩效域

Else 的博客 1870

运放+三极管恒流源电路设计实战:从原理到仿真一步到位(附Multisim文件)

本文详细解析了运放与三极管构建恒流源电路的核心原理,重点阐述了负反馈机制如何实现精准的电流控制。通过Multisim仿真实战,从电路搭建、参数计算到负载调整率与动态响应分析,一步步指导设计过程,并提供常见故障的调试技巧与PCB设计要点,帮助工程师从理论平稳过渡到可靠实践。

7z8x2c4v6b9的博客 717

Codeforces-976E - Well played! - 贪心

题解链接: https://lucien.ink/archives/194/ 题目链接: http://codeforces.com/contest/976/problem/E 题目: Recently Max has got himself into popular CCG “BrainStone”. As “BrainStone” is a pretty intellectu...

LucienShui 960

2025MCM美赛 数学建模 问题 C:奥运奖牌榜模型 思路+matlab代码+python代码

目录问题一详细思路步骤1. 数据准备与预处理2. 特征选择与构建3. 模型选择4. 模型训练与评估5. 预测与不确定性分析6. 分析与结果解释步骤详细代码实现python代码代码解析matlab代码问题二详细思路解决方案步骤1. 构建生产模型:2. 优化决策:3. 代码实现:代码解析matlab代码问题三的详细思路解决思路:代码实现1. 数据准备2. 代码实现matlab代码在这个问题中,我们的目标是根据历史奥运会的数据,建立一个模型来预测2028年洛杉矶奥运会各国的奖牌数。具体要求是:首先,整理并加载奥运

斌擎科技 2147

【Codeforces Round#593 (Div. 2)】A. Stones 题解

题目链接:A. Stones 题目 Alice is playing with some stones. Now there are three numbered heaps of stones. The first of them contains a stones, the second of them contains b stones and the third of them conta...

qq_37504214的博客 481

IPGUARD客户端与应用程序冲突

客户端与应用程序冲突 症状 安装客户端之后,客户端的某些程序无法运行或使用过程中出现异常,卸载客户端后恢复正常。 原因分析 可能是客户端的某些功能与应用程序发生冲突导致。 解决方法 当出现这样的情况时,可以按照以下步骤确认。 步骤1:屏蔽主动注入 在客户端配置策略中,增加配置策略hookapi_disinj,值为1;待策略同步到客户端后,重启客户端确认问题是否解决。如果解决,则转到...

IP-Guard专栏 1414

38.XDMA寄存器详解2-H2C、C2H通道寄存器组剖析

目录 1.上节回顾 2. H2C寄存器剖析 2.1 H2C通道标识寄存器(0x00) 2.2 H2C通道控制寄存器(0x04) 2.3 H2C通道状态寄存器(0x40) 2.4 H2C通道完成描述符数量寄存器(0x48) 2.5 H2C通道对齐寄存器(0x4C) 2.6 H2C通道查询模式回写地址寄存器(0x88、0x8C) 2.7 H2C通道中断掩码寄存器(0x90)​ 2.8 H2C通道性能监视控制寄存器(0xC0) 2.9 H2C通道周期计数性能寄存器(0xC4、0xC8) 2

一个早起的程序员 5218

Codeforces Contest 1110 problem E Magic Stones —— 更改算式

Grigory has n magic stones, conveniently numbered from 1 to n. The charge of the i-th stone is equal to ci. Sometimes Grigory gets bored and selects some inner stone (that is, some stone with index i,...

天翼之城的博客 405

使用GBIF获取生物多样性数据与GIS的结合

随着全球生物多样性的重要性日益凸显,越来越多的研究人员和保护机构开始利用地理信息系统(GIS)来分析和可视化生物多样性数据。GBIF(全球生物多样性信息设施)作为一个全球性的生物多样性数据库,提供了大量的物种分布和分类信息,为研究人员和保护工作者提供了宝贵的数据资源。本文将介绍如何使用GBIF API获取生物多样性数据,并将其与GIS技术相结合,以便更好地理解和研究生物多样性。利用GIS的强大功能,我们可以在地理空间上可视化物种分布、分析物种多样性的空间格局,并为保护生物多样性提供科学依据。

BnxBackend的博客 1766

Codeforces 246C Little Girl And Maximum 差分

题意:n个数,m次询问 n,m 最后的累加和可以写为:ans=segma(a[i]*f[i]) 每次询问l,r时 如何快速计算f?  用线段树区间更新使f[l]~f[r]同时加上1,最后单点查询计算出f,比较麻烦 利用差分,每次更新时:c[l]++,c[r+1]-- 最后计算i的前缀和,即可求出i被包含在多少条线段(询问)中啦  ai 因为a[i]·b[j]+a[j]·b[i]-a[i

Masamiiiiii 1171

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

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

codeforces 727c 交互式输入(水)

点击打开链接 #include #include #include #include #include using namespace std; const int N=1e4+20; int a[N]; int main() { int x,y,z,n; scanf("%d",&n); printf("? 1 2\n"); fflush(stdout); scanf("

Masamiiiiii 1090

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

Codeforces 768B Code For 1 二分+区间查询

点击打开链接 题意:给出n1 则把n变为n/2,n%2,n/2,问[l,r]内1的个数? f[n]为n展开后得到的数字个数: f[n]=2*f[n/2]+1  迭代化解得到 f[n]=2^(log(2,n)+1)-1 d[n]=n%2+2*d[n/2] d[1]=1,容易归纳得到n展开后会得到n个1  要求查询的区间为[l,r] 从起始区间(n,1,1+length(n)-1

Masamiiiiii 882

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

Codeforces 796D Police Stations 构造+BFS

点击打开链接 题意:n个点的树,k个为黑色,law:任意点距离d内都有黑点,n,k,d 由于是树,每删除一条边 都增加一个联通分量,无论d是多少,每个联通分量内都要有一个黑点,所以删除的边不会超过k-1. 一开始已经满足law,任意点到黑点的最短距离 可以构造k个合法的联通分量:对每个点u,把它加入到和它最近的黑点的联通分量中,黑点距离自己为0,同一个联通分量只有一个黑

Masamiiiiii 871

Codeforces 797D Broken BST dfs+模拟

点击打开链接 题意:n 若暴力查询 最坏时,树退化成链O(n^2)   一个值x能被查询到,当且仅当从root起往值x走的路径中,端点p向右走的值都比x小,端点q向左走的值都比x大 则x>=max(p) && x #include using namespace std; typedef long long ll; const int N=2e5+20; const int inf

Masamiiiiii 811

codeforces 731F 暴力(前缀和)

点击打开链接 //枚举a[i]作为secondary   //其余要选的数 必须为a[i]的倍数  x=p*a[i]  //如果 a[j]在p*a[i]~(p+1)*a[i]之间 按照题意 a[j]可以降为p*a[i] //重点:如何快速判断 p*a[i]~(p+1)*a[i]-1之间有多少个a[j]?  //利用前缀和思想 cnt[i]记录1~i中出现的元素个数  则a,b内元素

Masamiiiiii 794

Codeforces 746D Green And Black Tea 构造

点击打开链接 题意:有n杯茶,a杯绿茶,b杯红茶,问怎么摆放才可以让不超过k杯一样的茶连续摆放,如果不能就输出NO。 //颜色少的Y至少要有n/(k+1)个 插入后如果还有剩下,则在每组里面隔一个间隔插入即可  #include using namespace std; typedef long long ll; const int N=2e5+20; char s[N]; int m

Masamiiiiii 792

Codeforces 110C Lucky Sum Of Digits 暴力

点击打开链接 题意:求digit和为n(n 假设最后有p个4,q个7 为了最小:4排在前面,7排在后面,求出4,7个数即可 4p+7q=n 枚举q,p=(n-7q)/4,数字尽量小->位数p+q尽量小,q尽量小即可.  #include using namespace std; const int N=2e3+20; int n; bool flag; int main() { w

Masamiiiiii 761

hdu 5646 Partition数学+构造

点击打开链接 //把n拆分成不同k个数之和 使得k个数乘积最大 //因为C=A+B  A+2AB  //推出k个数为连续的 或者为连续两段中间差2,构造这k个数即可  #include #include #include #include #include using namespace std; typedef long long ll; const ll mod=1e9+

Masamiiiiii 728

AGC 015C Nuske vs Phantom Thnook 思维+二维前缀和

点击打开链接 题意:n*m矩阵,n,m q个询问,q 同一个连通分量中任意两点只有一条路径,于是对相邻的每个1连接一条边,每一个连通分量显然都为一颗树 若子矩形有k个联通分量,因为每个联通分量都为树,则子矩形中点数-边数等于k 利用二维前缀和求出子矩形1的个数(点)和相邻1(边)个数即可 复杂度O(mn+q) #include using namespace std; co

Masamiiiiii 723

Codeforces 733B Parade暴力

点击打开链接 有1e5行2列 只有一次操作,暴力枚举要换的行即可 #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; const ll mod=1e9+7; const int N= 1e6+20; i

Masamiiiiii 713

Codeforces 782C Andryusha and Colored Balloons dfs

点击打开链接 题意:n dfs遍历时,保证当前子结点颜色和祖先u,fa[u]结点颜色不同 && 兄弟结点的颜色要不同即可 #include using namespace std; typedef long long ll; const int N=4e5+20; int n,c[N],ans; pair p[N]; vector e[N]; void dfs(int u,in

Masamiiiiii 711

Codeforces 734D Anton and Chess 几何+模拟

点击打开链接 最后In Check的棋子来自king 8个方向中的最近的棋子 保留该棋子 最后在判断下即可  #include #include #include #include #include #include using namespace std; typedef long long ll; const int N=5e5+20; struct point{ cha

Masamiiiiii 700
上一篇: Codeforces 427C Checkposts 强连通分量(tarjan)
下一篇: Codeforces 149C Division Into Teams 构造
Masamiiiii
博客等级 码龄11年 32粉丝 625原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值